0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-25 00:06:09 -05:00
penpot/backend/src/uxbox/migrations.clj

88 lines
3 KiB
Clojure
Raw Normal View History

;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
2020-05-26 12:28:35 +02:00
;; This Source Code Form is "Incompatible With Secondary Licenses", as
;; defined by the Mozilla Public License, v. 2.0.
;;
;; Copyright (c) 2020 UXBOX Labs SL
(ns uxbox.migrations
(:require
[mount.core :as mount :refer [defstate]]
[uxbox.db :as db]
[uxbox.config :as cfg]
2020-06-01 13:19:35 +02:00
[uxbox.util.migrations :as mg]))
2019-11-22 18:09:13 +01:00
(def +migrations+
{:name "uxbox-main"
:steps
[{:desc "Add initial extensions and functions."
:name "0001-add-extensions"
:fn (mg/resource "migrations/0001-add-extensions.sql")}
{:desc "Add profile related tables"
:name "0002-add-profile-tables"
:fn (mg/resource "migrations/0002-add-profile-tables.sql")}
{:desc "Add project related tables"
:name "0003-add-project-tables"
:fn (mg/resource "migrations/0003-add-project-tables.sql")}
{:desc "Add tasks related tables"
:name "0004-add-tasks-tables"
:fn (mg/resource "migrations/0004-add-tasks-tables.sql")}
{:desc "Add libraries related tables"
:name "0005-add-libraries-tables"
:fn (mg/resource "migrations/0005-add-libraries-tables.sql")}
{:desc "Add presence related tables"
:name "0006-add-presence-tables"
:fn (mg/resource "migrations/0006-add-presence-tables.sql")}
{:desc "Drop version field from page table."
:name "0007-drop-version-field-from-page-table"
:fn (mg/resource "migrations/0007-drop-version-field-from-page-table.sql")}
{:desc "Add generic token related tables."
2020-05-26 12:28:35 +02:00
:name "0008-add-generic-token-table"
:fn (mg/resource "migrations/0008-add-generic-token-table.sql")}
{:desc "Drop the profile_email table"
2020-05-26 12:28:35 +02:00
:name "0009-drop-profile-email-table"
:fn (mg/resource "migrations/0009-drop-profile-email-table.sql")}
{:desc "Add new HTTP session table"
:name "0010-add-http-session-table"
:fn (mg/resource "migrations/0010-add-http-session-table.sql")}
{:desc "Add session_id field to page_change table"
:name "0011-add-session-id-field-to-page-change-table"
:fn (mg/resource "migrations/0011-add-session-id-field-to-page-change-table.sql")}
{:desc "Make libraries linked to a file"
:name "0012-make-libraries-linked-to-a-file"
2020-08-04 12:05:54 +02:00
:fn (mg/resource "migrations/0012-make-libraries-linked-to-a-file.sql")}
{:desc "Mark files shareable"
:name "0013-mark-files-shareable"
:fn (mg/resource "migrations/0013-mark-files-shareable.sql")}
{:desc "Refactor media storage"
:name "0014-refactor-media-storage.sql"
:fn (mg/resource "migrations/0014-refactor-media-storage.sql")}]})
2017-03-25 19:35:28 +01:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Entry point
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn migrate
[]
(with-open [conn (db/open)]
(mg/setup! conn)
(mg/migrate! conn +migrations+)))
(defstate migrations
:start (migrate))