migration

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2022 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2023 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2023 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2023 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2023 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2023 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2023 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2023 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2023 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2023 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2024 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2024 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2022 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

* Virtualpaper is a service to manage users paper documents in virtual format. * Copyright (C) 2022 Tero Vierimaa * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var Migrations = []Migrator{
	&Migration{
		Name:   "initial schema",
		Level:  1,
		Schema: schemaV1,
	},
	&Migration{
		Name:   "file processing queue",
		Level:  2,
		Schema: schemaV2,
	},
	&Migration{
		Name:   "document metadata",
		Level:  3,
		Schema: schemaV3,
	},
	&Migration{
		Name:   "processing rules",
		Level:  4,
		Schema: schemaV4,
	},
	&Migration{
		Name:   "support for user preferences",
		Level:  5,
		Schema: schemaV5,
	},
	&Migration{
		Name:   "cascade deletions, add deleted_at col to documents",
		Level:  6,
		Schema: schemaV6,
	},
	&Migration{
		Name:   "add rules v2",
		Level:  7,
		Schema: schemaV7,
	},
	&Migration{
		Name:   "add missing on cascade delete constraints",
		Level:  8,
		Schema: schemaV8,
	},
	&Migration{
		Name:   "add document history table",
		Level:  9,
		Schema: schemaV9,
	},
	&Migration{
		Name:   "add linked documents table",
		Level:  10,
		Schema: schemaV10,
	},
	&Migration{
		Name:   "add document show history table",
		Level:  11,
		Schema: schemaV11,
	},
	&Migration{
		Name:   "add table for password resets",
		Level:  12,
		Schema: schemaV12,
	},
	&Migration{
		Name:   "add support for persisted auth tokens",
		Level:  13,
		Schema: schemaV13,
	},
	&Migration{
		Name:   "auth_tokens store last_confirmed status",
		Level:  14,
		Schema: schemaV14,
	},
	&Migration{
		Name:   "enforce case-insensitive unique user names and emails",
		Level:  15,
		Schema: schemaV15,
	},
	&Migration{
		Name:   "split process_queue.step to action and action_order",
		Level:  16,
		Schema: schemaV16,
	},
	&Migration{
		Name:   "add list of languages",
		Level:  17,
		Schema: schemaV17,
	},
	&Migration{
		Name:   "add support for metadata icon and style",
		Level:  18,
		Schema: schemaV18,
	},
	&Migration{
		Name:   "add user_shared_documents table",
		Level:  19,
		Schema: schemaV19,
	},
	&Migration{
		Name:   "add favorite column to documents",
		Level:  20,
		Schema: schemaV20,
	},
	&Migration{
		Name:   "add rule trigger column",
		Level:  21,
		Schema: schemaV21,
	},
}

Functions

func Migrate

func Migrate(db *sqlx.DB, migrations []Migrator) error

Migrate runs given migrations

Types

type Migration

type Migration struct {
	Name   string
	Level  int
	Schema string
}

Migration implements migrator

func (*Migration) MLevel

func (m *Migration) MLevel() int

func (*Migration) MName

func (m *Migration) MName() string

func (*Migration) MSchema

func (m *Migration) MSchema() string

type Migrator

type Migrator interface {
	// Get migration name
	MName() string
	// Get migration level
	MLevel() int
	// Get valid sql string to execute
	MSchema() string
}

Migrator describes single migration level

type Schema

type Schema struct {
	Level     int       `db:"level"`
	Success   int       `db:"success"`
	Timestamp time.Time `db:"timestamp"`
	TookMs    int       `db:"took_ms"`
}

func CurrentVersion

func CurrentVersion(db *sqlx.DB) (Schema, error)

CurrentVersion returns current version

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL