Skip to content

Commit

Permalink
fix: move globals.sql & initial schema to utils
Browse files Browse the repository at this point in the history
and switch on the proper one depending on dbVersion
  • Loading branch information
soedirgo committed Dec 9, 2021
1 parent 982d786 commit 2138139
Show file tree
Hide file tree
Showing 7 changed files with 1,448 additions and 1,695 deletions.
16 changes: 0 additions & 16 deletions internal/init/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ var (
// | sed '/^CREATE ROLE postgres;/d' \
// | sed '/^ALTER ROLE postgres WITH /d' \
// | sed "/^ALTER ROLE .* WITH .* LOGIN /s/;$/ PASSWORD 'postgres';/"
//go:embed templates/globals_sql
globalsSql []byte
// pg_dump --dbname $DB_URL
//go:embed templates/init_migration_sql
initMigrationSql []byte
//go:embed templates/init_config
initConfigEmbed string
initConfigTemplate, _ = template.New("initConfig").Parse(initConfigEmbed)
Expand Down Expand Up @@ -66,18 +62,6 @@ func run() error {
if err := os.Mkdir("supabase/migrations", 0755); err != nil {
return err
}
if err := os.WriteFile(
"supabase/migrations/"+utils.GetCurrentTimestamp()+"_init.sql",
initMigrationSql,
0644,
); err != nil {
return err
}

// 2. Write `extensions.sql`, `globals.sql`.
if err := os.WriteFile("supabase/globals.sql", globalsSql, 0644); err != nil {
return err
}

// 2. Write `config.json`.
{
Expand Down

0 comments on commit 2138139

Please sign in to comment.