mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-07 06:03:09 -06:00
Update migrations
This commit is contained in:
parent
bd1fec5c3f
commit
81af874b0b
|
|
@ -27,7 +27,8 @@ func LoadAddHistoryVisibilityColumn(m *sqlutil.Migrations) {
|
||||||
|
|
||||||
func UpAddHistoryVisibilityColumn(tx *sql.Tx) error {
|
func UpAddHistoryVisibilityColumn(tx *sql.Tx) error {
|
||||||
_, err := tx.Exec(`
|
_, err := tx.Exec(`
|
||||||
ALTER TABLE syncapi_output_room_events ADD COLUMN IF NOT EXISTS history_visibility SMALLINT NOT NULL DEFAULT 3;
|
ALTER TABLE syncapi_output_room_events ADD COLUMN IF NOT EXISTS history_visibility SMALLINT NOT NULL DEFAULT 2;
|
||||||
|
UPDATE syncapi_output_room_events SET history_visibility = 4 WHERE type IN ('m.room.message', 'm.room.encrypted');
|
||||||
`)
|
`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to execute upgrade: %w", err)
|
return fmt.Errorf("failed to execute upgrade: %w", err)
|
||||||
|
|
@ -37,7 +38,7 @@ func UpAddHistoryVisibilityColumn(tx *sql.Tx) error {
|
||||||
|
|
||||||
func DownAddHistoryVisibilityColumn(tx *sql.Tx) error {
|
func DownAddHistoryVisibilityColumn(tx *sql.Tx) error {
|
||||||
_, err := tx.Exec(`
|
_, err := tx.Exec(`
|
||||||
ALTER TABLE syncapi_output_room_events DROP COLUMN IF EXISTS sent_by_token;
|
ALTER TABLE syncapi_output_room_events DROP COLUMN IF EXISTS history_visibility;
|
||||||
`)
|
`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to execute downgrade: %w", err)
|
return fmt.Errorf("failed to execute downgrade: %w", err)
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ func UpAddHistoryVisibilityColumn(tx *sql.Tx) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
_, err = tx.Exec(`
|
_, err = tx.Exec(`
|
||||||
ALTER TABLE syncapi_output_room_events ADD COLUMN history_visibility SMALLINT NOT NULL DEFAULT 3;
|
ALTER TABLE syncapi_output_room_events ADD COLUMN history_visibility SMALLINT NOT NULL DEFAULT 2;
|
||||||
|
UPDATE syncapi_output_room_events SET history_visibility = 4 WHERE type IN ('m.room.message', 'm.room.encrypted');
|
||||||
`)
|
`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to execute upgrade: %w", err)
|
return fmt.Errorf("failed to execute upgrade: %w", err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue