This repository has been archived by the owner on Jul 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cb19c582 - chore (cli): extract cli to separate package (#1317) 2024-06-25 13:45:14 +0000 - Kevin electric-sql/electric@cb19c582
- Loading branch information
1 parent
c1f1671
commit db8045d
Showing
6 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/electricsql/test/migrators/support/migrations/20230613112725_814/metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"format": "SatOpMigrate", | ||
"ops": [ | ||
"GocBCgVzdGFycxISCgJpZBIEVEVYVBoGCgR0ZXh0EhoKCmF2YXRhcl91cmwSBFRFWFQaBgoEdGV4dBIUCgRuYW1lEgRURVhUGgYKBHRleHQSGgoKc3RhcnJlZF9hdBIEVEVYVBoGCgR0ZXh0EhgKCHVzZXJuYW1lEgRURVhUGgYKBHRleHQiAmlkChIyMDIzMDYxMzExMjcyNV84MTQS1QES0gFDUkVBVEUgVEFCTEUgInN0YXJzIiAoCiAgImlkIiBURVhUIE5PVCBOVUxMLAogICJhdmF0YXJfdXJsIiBURVhUIE5PVCBOVUxMLAogICJuYW1lIiBURVhULAogICJzdGFycmVkX2F0IiBURVhUIE5PVCBOVUxMLAogICJ1c2VybmFtZSIgVEVYVCBOT1QgTlVMTCwKICBDT05TVFJBSU5UICJzdGFyc19wa2V5IiBQUklNQVJZIEtFWSAoImlkIikKKSBXSVRIT1VUIFJPV0lEOwo=" | ||
], | ||
"protocol_version": "Electric.Satellite", | ||
"version": "20230613112725_814" | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/electricsql/test/migrators/support/migrations/20230613112725_814/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CREATE TABLE "stars" ( | ||
"id" TEXT NOT NULL, | ||
"avatar_url" TEXT NOT NULL, | ||
"name" TEXT, | ||
"starred_at" TEXT NOT NULL, | ||
"username" TEXT NOT NULL, | ||
CONSTRAINT "stars_pkey" PRIMARY KEY ("id") | ||
); |
8 changes: 8 additions & 0 deletions
8
packages/electricsql/test/migrators/support/migrations/20230613112735_992/metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"format": "SatOpMigrate", | ||
"ops": [ | ||
"Gk4KBWJlZXJzEhIKAmlkEgRURVhUGgYKBHRleHQSFwoHc3Rhcl9pZBIEVEVYVBoGCgR0ZXh0GhQKB3N0YXJfaWQSBXN0YXJzGgJpZCICaWQKEjIwMjMwNjEzMTEyNzM1Xzk5MhLVARLSAUNSRUFURSBUQUJMRSAiYmVlcnMiICgKICAiaWQiIFRFWFQgTk9UIE5VTEwsCiAgInN0YXJfaWQiIFRFWFQsCiAgQ09OU1RSQUlOVCAiYmVlcnNfc3Rhcl9pZF9ma2V5IiBGT1JFSUdOIEtFWSAoInN0YXJfaWQiKSBSRUZFUkVOQ0VTICJzdGFycyIgKCJpZCIpLAogIENPTlNUUkFJTlQgImJlZXJzX3BrZXkiIFBSSU1BUlkgS0VZICgiaWQiKQopIFdJVEhPVVQgUk9XSUQ7Cg==" | ||
], | ||
"protocol_version": "Electric.Satellite", | ||
"version": "20230613112735_992" | ||
} |
6 changes: 6 additions & 0 deletions
6
packages/electricsql/test/migrators/support/migrations/20230613112735_992/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE "beers" ( | ||
"id" TEXT NOT NULL, | ||
"star_id" TEXT, | ||
CONSTRAINT "beers_star_id_fkey" FOREIGN KEY ("star_id") REFERENCES "stars" ("id"), | ||
CONSTRAINT "beers_pkey" PRIMARY KEY ("id") | ||
); |
23 changes: 23 additions & 0 deletions
23
packages/electricsql_cli/test/src/cli/migrations/builder_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:electricsql/migrators.dart'; | ||
import 'package:electricsql_cli/src/commands/generate/builder.dart'; | ||
import 'package:path/path.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
final migrationsFolder = Directory( | ||
join( | ||
Directory.current.path, | ||
'../electricsql/test/migrators/support/migrations', | ||
), | ||
); | ||
|
||
test('read migration meta data', () async { | ||
for (final builder in [kSqliteQueryBuilder, kPostgresQueryBuilder]) { | ||
final migrations = await loadMigrations(migrationsFolder, builder); | ||
final versions = migrations.map((m) => m.version); | ||
expect(versions, ['20230613112725_814', '20230613112735_992']); | ||
} | ||
}); | ||
} |