-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #700 from seb-oss/feat/spanner-migrate
Update Spanner migrate to use SQL migrations files
- Loading branch information
Showing
13 changed files
with
132 additions
and
100 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@sebspark/spanner-migrate": minor | ||
--- | ||
|
||
switched from .ts to .sql migrations files |
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
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
14 changes: 14 additions & 0 deletions
14
...ges/spanner-migrate/src/__tests__/e2e/migrations/20250120145638000_create_table_users.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,14 @@ | ||
-- Created: 2025-01-20T14:56:38.000Z | ||
-- Description: create table users | ||
|
||
---- UP ---- | ||
|
||
CREATE TABLE users ( | ||
id INT64 NOT NULL, | ||
username STRING(50) NOT NULL, | ||
email STRING(100) NOT NULL, | ||
) PRIMARY KEY (id); | ||
|
||
---- DOWN ---- | ||
|
||
DROP TABLE users; |
14 changes: 0 additions & 14 deletions
14
...ages/spanner-migrate/src/__tests__/e2e/migrations/20250120145638000_create_table_users.ts
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
...igrate/src/__tests__/e2e/migrations/20250121144738000_create_table_and_index_adresses.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,28 @@ | ||
-- Created: 2025-01-21T14:48:38.000Z | ||
-- Description: create table and index adresses | ||
|
||
---- UP ---- | ||
|
||
CREATE TABLE addresses ( | ||
id STRING(36) NOT NULL, -- Unique identifier for the address | ||
user_id STRING(36) NOT NULL, -- ID of the user associated with the address | ||
street STRING(256), -- Street name and number | ||
city STRING(128), -- City name | ||
state STRING(128), -- State or region | ||
zip_code STRING(16), -- Postal code | ||
country STRING(128), -- Country name | ||
created_at TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp = true), -- Timestamp of creation | ||
updated_at TIMESTAMP OPTIONS (allow_commit_timestamp = true) -- Timestamp of last update | ||
) PRIMARY KEY (id); | ||
|
||
-- Create an index on user_id for faster lookups by user | ||
CREATE INDEX idx_addresses_user_id ON addresses (user_id); | ||
|
||
|
||
---- DOWN ---- | ||
|
||
-- Drop the index first (Spanner requires indexes to be dropped before dropping the table) | ||
DROP INDEX idx_addresses_user_id; | ||
|
||
-- Drop the table | ||
DROP TABLE addresses; |
27 changes: 0 additions & 27 deletions
27
...migrate/src/__tests__/e2e/migrations/20250121144738000_create_table_and_index_adresses.ts
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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