Skip to content

Commit

Permalink
satellite/satellitedb: add columns last_offline_email and last_softwa…
Browse files Browse the repository at this point in the history
…re_update_email

Change-Id: I8b5023bbbba55de633ce5ac3faf3361352c202ef
  • Loading branch information
cam-a committed Nov 11, 2022
1 parent 6273ed0 commit 5f6b490
Show file tree
Hide file tree
Showing 8 changed files with 1,058 additions and 108 deletions.
3 changes: 3 additions & 0 deletions satellite/satellitedb/dbx/satellitedb.dbx
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ model node (
field exit_success bool ( updatable, default false )

field contained timestamp ( updatable, nullable )

field last_offline_email timestamp ( updatable, nullable )
field last_software_update_email timestamp ( updatable, nullable )
)

update node ( where node.id = ? )
Expand Down
348 changes: 242 additions & 106 deletions satellite/satellitedb/dbx/satellitedb.dbx.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions satellite/satellitedb/dbx/satellitedb.dbx.pgx.sql
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ CREATE TABLE nodes (
exit_finished_at timestamp with time zone,
exit_success boolean NOT NULL DEFAULT false,
contained timestamp with time zone,
last_offline_email timestamp with time zone,
last_software_update_email timestamp with time zone,
PRIMARY KEY ( id )
);
CREATE TABLE node_api_versions (
Expand Down
2 changes: 2 additions & 0 deletions satellite/satellitedb/dbx/satellitedb.dbx.pgxcockroach.sql
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ CREATE TABLE nodes (
exit_finished_at timestamp with time zone,
exit_success boolean NOT NULL DEFAULT false,
contained timestamp with time zone,
last_offline_email timestamp with time zone,
last_software_update_email timestamp with time zone,
PRIMARY KEY ( id )
);
CREATE TABLE node_api_versions (
Expand Down
9 changes: 9 additions & 0 deletions satellite/satellitedb/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,15 @@ func (db *satelliteDB) PostgresMigration() *migrate.Migration {
`ALTER TABLE nodes ADD COLUMN contained timestamp with time zone;`,
},
},
{
DB: &db.migrationDB,
Description: "Add columns last_offline_email and last_software_update_email",
Version: 217,
Action: migrate.SQL{
`ALTER TABLE nodes ADD COLUMN last_offline_email timestamp with time zone;`,
`ALTER TABLE nodes ADD COLUMN last_software_update_email timestamp with time zone;`,
},
},
// NB: after updating testdata in `testdata`, run
// `go generate` to update `migratez.go`.
},
Expand Down
4 changes: 3 additions & 1 deletion satellite/satellitedb/migratez.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func (db *satelliteDB) testMigration() *migrate.Migration {
{
DB: &db.migrationDB,
Description: "Testing setup",
Version: 216,
Version: 217,
Action: migrate.SQL{`-- AUTOGENERATED BY storj.io/dbx
-- DO NOT EDIT
CREATE TABLE accounting_rollups (
Expand Down Expand Up @@ -191,6 +191,8 @@ CREATE TABLE nodes (
exit_finished_at timestamp with time zone,
exit_success boolean NOT NULL DEFAULT false,
contained timestamp with time zone,
last_offline_email timestamp with time zone,
last_software_update_email timestamp with time zone,
PRIMARY KEY ( id )
);
CREATE TABLE node_events (
Expand Down
2 changes: 1 addition & 1 deletion satellite/satellitedb/testdata/postgres.v212.sql
Original file line number Diff line number Diff line change
Expand Up @@ -748,4 +748,4 @@ INSERT INTO "projects"("id", "public_id", "name", "description", "usage_limit",

INSERT INTO "users" ("id", "full_name", "email", "normalized_email", "password_hash", "status", "created_at", "mfa_enabled", "mfa_secret_key", "mfa_recovery_codes", "signup_promo_code", "project_limit", "project_bandwidth_limit", "project_storage_limit", "project_segment_limit", "verification_reminders", "signup_captcha") VALUES (E'\\363\\311\\033w\\222\\303Ci\\266\\344U\\304\\312\\206",'::bytea, 'Harold Smith', '1testemail206@mail.test', '1TESTEMAIL206@MAIL.TEST', E'some_readable_hash'::bytea, 1, '2021-08-14 09:13:44.614594+00', true, 'mfa secret key', '["1a2b3c4d","e5f6d7h8"]', 'promo123', 3, 50000000000, 50000000000, 150000, 1, 1);

-- NEW DATA --
-- NEW DATA --

0 comments on commit 5f6b490

Please sign in to comment.