mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
* add marketplace icon to info response * fix max eos version available logic; toggle migrations * only send icon if it exists * increase upload timeout * persist eos version and arch for user activity * filter eos versions available based on arch * remove registry icon * remove eos upload from publish script * filter package index response by arch * remove arch from version record in favor of join table * allow previous user activity records to contain null values * make arch optional for backwards compatability * make arch optional for backwards compatability on version latest endpoint * not ideal but functional solution for backwards compatible arch filter * insert version platform when index on publish upload * add migration for dropping arch from package version table * upsert all version platform records * insert user activity even if version and arch do not exist * increase http timeout to 10 minutes jic * remove user metrics from latest endpoint
50 lines
2.4 KiB
Haskell
50 lines
2.4 KiB
Haskell
module Migration where
|
|
|
|
import Database.Persist.Migration ( Column(Column)
|
|
, ColumnProp(NotNull)
|
|
, MigrateSql(MigrateSql)
|
|
, Migration
|
|
, MigrationPath((:=))
|
|
, Operation(AddColumn, DropColumn, RawOperation)
|
|
, PersistValue(PersistText)
|
|
, SqlType(SqlString)
|
|
, rawSql
|
|
)
|
|
import Database.Persist.Sql ( Single(..) )
|
|
import Startlude ( ($)
|
|
, (<<$>>)
|
|
, Maybe(Just)
|
|
)
|
|
|
|
manualMigration :: Migration
|
|
manualMigration = [(0, 1) := migration_0_2_0, (1, 2) := migration_0_2_1, (2, 3) := migration_0_2_2]
|
|
|
|
migration_0_2_2 :: [Operation]
|
|
migration_0_2_2 = [DropColumn ("version", "arch")]
|
|
|
|
migration_0_2_1 :: [Operation]
|
|
migration_0_2_1 = [DropColumn ("category", "parent")]
|
|
|
|
migration_0_2_0 :: [Operation]
|
|
migration_0_2_0 =
|
|
[ AddColumn "version" (Column "title" SqlString [NotNull]) (Just $ PersistText "")
|
|
, AddColumn "version" (Column "desc_short" SqlString [NotNull]) (Just $ PersistText "")
|
|
, AddColumn "version" (Column "desc_long" SqlString [NotNull]) (Just $ PersistText "")
|
|
, AddColumn "version" (Column "icon_type" SqlString [NotNull]) (Just $ PersistText "")
|
|
, populateMetadata
|
|
, DropColumn ("pkg_record", "title")
|
|
, DropColumn ("pkg_record", "desc_short")
|
|
, DropColumn ("pkg_record", "desc_long")
|
|
, DropColumn ("pkg_record", "icon_type")
|
|
]
|
|
|
|
populateMetadata :: Operation
|
|
populateMetadata =
|
|
RawOperation "Populating Metadata"
|
|
$ migrateMetadata
|
|
<<$>> rawSql "SELECT pkg_id, title, desc_short, desc_long, icon_type FROM pkg_record" []
|
|
where
|
|
migrateMetadata (Single id', Single title', Single descShort', Single descLong', Single iconType') = MigrateSql
|
|
"UPDATE version SET title = ?, desc_short = ?, desc_long = ?, icon_type = ? where pkg_id = ?"
|
|
[PersistText title', PersistText descShort', PersistText descLong', PersistText iconType', PersistText id']
|