Fix alteration of items table
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2021-10-30 10:25:57 +02:00
parent 43472a64e7
commit 44ec376bda
Signed by: peter
GPG Key ID: 374322D56E5209E8

View File

@ -57,19 +57,14 @@ CREATE TABLE IF NOT EXISTS "items" (
);
`)
if err != nil {
_, err = conn.ExecContext(ctx, `
ALTER TABLE "items"
ALTER COLUMN "data" TYPE jsonb
ALTER COLUMN "uid" TYPE varchar(1024);
);
`)
if err != nil {
return fmt.Errorf("create items table failed: %w", err)
}
return fmt.Errorf("create items table failed: %w", err)
}
_, err = conn.ExecContext(ctx, `ALTER TABLE "items" ALTER COLUMN "data" TYPE jsonb, ALTER COLUMN "uid" TYPE varchar(1024)`)
if err != nil {
return fmt.Errorf("alter items table failed: %w", err)
}
_, err = conn.ExecContext(ctx, `INSERT INTO "channels" ("name", "created_at") VALUES ($1, DEFAULT)
ON CONFLICT DO NOTHING`, p.channel)
if err != nil {