Files
mostlymatter/db/migrations/postgres/000002_create_team_members.up.sql
John Tzikas 809affd6d1 Create basic make commands for configuring golang-migrate (#16938)
* Create basic make commands for configuring golang-migrate

* Showcase full flow with new migrations

* Apply PR suggestions

* Migrate over team members

* Update mocks

* Fix specs

* Move columns that added after table creation onto separate stmts

* Put back gorp table definitions

* Fix issues with golang-migrate that not tracks underlying db driver

* Help prompt after new migration and consistent checksum for bindata

* Put gorp mapping back

* Apply PR suggestiong

* Close migrations after they run

* Add migration file to bindata check

* Updates needed

* Reset store_test

* Add copyright

* Apply PR suggestions

* Fix new circleci check

* Put back upgrade step for backwards comp

* Add store test to test migration directions

* Apply PR suggestions

* Add go-bindata to tools

* Apply PR suggestios

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-23 16:22:31 +02:00

17 строки
696 B
SQL

CREATE TABLE IF NOT EXISTS teammembers (
teamid VARCHAR(26) NOT NULL,
userid VARCHAR(26) NOT NULL,
roles VARCHAR(64),
deleteat bigint,
PRIMARY KEY (teamid, userid)
);
CREATE INDEX IF NOT EXISTS idx_teammembers_team_id ON TeamMembers (teamid);
CREATE INDEX IF NOT EXISTS idx_teammembers_user_id ON TeamMembers (userid);
CREATE INDEX IF NOT EXISTS idx_teammembers_delete_at ON TeamMembers (deleteat);
ALTER TABLE teammembers ADD COLUMN IF NOT EXISTS schemeuser boolean;
ALTER TABLE teammembers ADD COLUMN IF NOT EXISTS schemeadmin boolean;
ALTER TABLE teammembers ADD COLUMN IF NOT EXISTS schemeguest boolean;
ALTER TABLE teammembers ADD COLUMN IF NOT EXISTS deleteat bigint;