Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into update-nara-from-…
Browse files Browse the repository at this point in the history
…master
  • Loading branch information
zeeshanakram3 committed Feb 27, 2024
2 parents 618acf0 + 743f56b commit 251363b
Show file tree
Hide file tree
Showing 18 changed files with 458 additions and 231 deletions.
5 changes: 3 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ lib
# Autogenerated stuff
src/types
src/model/generated
db/migrations/*.js
db/migrations/*-Data.js
db/migrations/*-Views.js
schema.graphql
/scripts/orion-v1-migration/data
/db/export
/db/export
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# 3.6.0

## Schema changes
- Added `includeInHomeFeed` field to `Video` entity indicating if the video should be included in the home feed/page.

## Mutations
### Additions
- `setOrUnsetPublicFeedVideos`: mutation to set or unset the `includeInHomeFeed` field of a video by the Operator.

### Queries
#### Additions
- `dumbPublicFeedVideos`: resolver to retrieve random `N` videos from list of all homepage videos.

## DB Migrations
- Added partial index on `Video` entity to include only videos that are included in the home feed (in `db/migrations/2200000000000-Indexes.js`)

# 3.5.0

## Schema changes
- Added `isShort` field to `Video` entity indicating whether a video is a short format, vertical video or not.

## Misc
- Disable both in App and email notifications for `videoPosted` notifiations type by default.
- Remove unused `@joystream/metadata-protobuf` patch from assets/patches directory.

# 3.4.0

## Schema changes
Expand Down
4 changes: 3 additions & 1 deletion db/migrations/1000000000000-Admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ module.exports = class Admin1000000000000 {
// Create a new "admin" schema through which the "hidden" entities can be accessed
await db.query(`CREATE SCHEMA "admin"`)
// Create admin user with "admin" schema in default "search_path"
await db.query(`CREATE USER "${process.env.DB_ADMIN_USER}" WITH PASSWORD '${process.env.DB_ADMIN_PASS}'`)
await db.query(
`CREATE USER "${process.env.DB_ADMIN_USER}" WITH PASSWORD '${process.env.DB_ADMIN_PASS}'`
)
await db.query(`GRANT pg_read_all_data TO "${process.env.DB_ADMIN_USER}"`)
await db.query(`GRANT pg_write_all_data TO "${process.env.DB_ADMIN_USER}"`)
await db.query(`ALTER USER "${process.env.DB_ADMIN_USER}" SET search_path TO admin,public`)
Expand Down
11 changes: 11 additions & 0 deletions db/migrations/1708500753099-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = class Data1708500753099 {
name = 'Data1708500753099'

async up(db) {
await db.query(`ALTER TABLE "admin"."video" ADD "is_short" boolean`)
}

async down(db) {
await db.query(`ALTER TABLE "admin"."video" DROP COLUMN "is_short"`)
}
}
11 changes: 11 additions & 0 deletions db/migrations/1708791753999-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = class Data1708791753999 {
name = 'Data1708791753999'

async up(db) {
await db.query(`ALTER TABLE "admin"."video" ADD "include_in_home_feed" boolean`)
}

async down(db) {
await db.query(`ALTER TABLE "admin"."video" DROP COLUMN "include_in_home_feed"`)
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

const { getViewDefinitions } = require('../viewDefinitions')

module.exports = class Views1708371131644 {
name = 'Views1708371131644'
module.exports = class Views1709038872576 {
name = 'Views1709038872576'

async up(db) {
const viewDefinitions = getViewDefinitions(db);
Expand Down
40 changes: 31 additions & 9 deletions db/migrations/2200000000000-Indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@ module.exports = class Indexes2200000000000 {
name = 'Indexes2200000000000'

async up(db) {
await db.query(`CREATE INDEX "events_video" ON "admin"."event" USING BTREE (("data"->>'video'));`)
await db.query(`CREATE INDEX "events_comment" ON "admin"."event" USING BTREE (("data"->>'comment'));`)
await db.query(
`CREATE INDEX "events_video" ON "admin"."event" USING BTREE (("data"->>'video'));`
)
await db.query(
`CREATE INDEX "events_comment" ON "admin"."event" USING BTREE (("data"->>'comment'));`
)
await db.query(
`CREATE INDEX "events_nft_owner_member" ON "admin"."event" USING BTREE (("data"->'nftOwner'->>'member'));`
)
await db.query(
`CREATE INDEX "events_nft_owner_channel" ON "admin"."event" USING BTREE (("data"->'nftOwner'->>'channel'));`
)
await db.query(`CREATE INDEX "events_auction" ON "admin"."event" USING BTREE (("data"->>'auction'));`)
await db.query(`CREATE INDEX "events_type" ON "admin"."event" USING BTREE (("data"->>'isTypeOf'));`)
await db.query(
`CREATE INDEX "events_auction" ON "admin"."event" USING BTREE (("data"->>'auction'));`
)
await db.query(
`CREATE INDEX "events_type" ON "admin"."event" USING BTREE (("data"->>'isTypeOf'));`
)
await db.query(`CREATE INDEX "events_nft" ON "admin"."event" USING BTREE (("data"->>'nft'));`)
await db.query(`CREATE INDEX "events_bid" ON "admin"."event" USING BTREE (("data"->>'bid'));`)
await db.query(`CREATE INDEX "events_member" ON "admin"."event" USING BTREE (("data"->>'member'));`)
await db.query(
`CREATE INDEX "events_member" ON "admin"."event" USING BTREE (("data"->>'member'));`
)
await db.query(
`CREATE INDEX "events_winning_bid" ON "admin"."event" USING BTREE (("data"->>'winningBid'));`
)
Expand All @@ -24,10 +34,21 @@ module.exports = class Indexes2200000000000 {
await db.query(
`CREATE INDEX "events_previous_nft_owner_channel" ON "admin"."event" USING BTREE (("data"->'previousNftOwner'->>'channel'));`
)
await db.query(`CREATE INDEX "events_buyer" ON "admin"."event" USING BTREE (("data"->>'buyer'));`)
await db.query(`CREATE INDEX "auction_type" ON "admin"."auction" USING BTREE (("auction_type"->>'isTypeOf'));`)
await db.query(`CREATE INDEX "member_metadata_avatar" ON "member_metadata" USING BTREE (("avatar"->>'avatarObject'));`)
await db.query(`CREATE INDEX "owned_nft_auction" ON "admin"."owned_nft" USING BTREE (("transactional_status"->>'auction'));`)
await db.query(
`CREATE INDEX "events_buyer" ON "admin"."event" USING BTREE (("data"->>'buyer'));`
)
await db.query(
`CREATE INDEX "auction_type" ON "admin"."auction" USING BTREE (("auction_type"->>'isTypeOf'));`
)
await db.query(
`CREATE INDEX "member_metadata_avatar" ON "member_metadata" USING BTREE (("avatar"->>'avatarObject'));`
)
await db.query(
`CREATE INDEX "owned_nft_auction" ON "admin"."owned_nft" USING BTREE (("transactional_status"->>'auction'));`
)
await db.query(
`CREATE INDEX video_include_in_home_feed_idx ON admin.video (include_in_home_feed) WHERE include_in_home_feed = true;`
)
}

async down(db) {
Expand All @@ -44,5 +65,6 @@ module.exports = class Indexes2200000000000 {
await db.query(`DROP INDEX "events_previous_nft_owner_member"`)
await db.query(`DROP INDEX "events_previous_nft_owner_channel"`)
await db.query(`DROP INDEX "events_buyer"`)
await db.query(`DROP INDEX "video_include_in_home_feed_idx"`)
}
}
8 changes: 4 additions & 4 deletions db/migrations/2300000000000-Operator.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const { randomAsHex } = require("@polkadot/util-crypto")
const { existsSync } = require("fs")
const { randomAsHex } = require('@polkadot/util-crypto')
const { existsSync } = require('fs')
const path = require('path')
const { OffchainState } = require('../../lib/utils/offchainState')

module.exports = class Operator2300000000000 {
name = 'Operator2300000000000'

async up(db) {
// Support only one operator account at the moment to avoid confusion
const exportFilePath = path.join(__dirname, '../export/export.json')
Expand All @@ -25,7 +25,7 @@ module.exports = class Operator2300000000000 {
// Create pg_stat_statements extension for analyzing query stats
await db.query(`CREATE EXTENSION pg_stat_statements;`)
}

async down(db) {
await db.query(`DELETE FROM "admin"."user" WHERE "is_root" = true;`)
await db.query(`DROP EXTENSION pg_stat_statements;`)
Expand Down
1 change: 0 additions & 1 deletion network-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@types/bmp-js": "^0.1.0",
"@types/bn.js": "^5.1.0",
"@joystream/types": "4.1.0",
"@joystream/metadata-protobuf": "2.9.0",
"@types/lowdb": "^1.0.9",
"async-lock": "^1.3.1",
"bmp-js": "^0.1.0",
Expand Down
Loading

0 comments on commit 251363b

Please sign in to comment.