Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Boldizsar Mezei committed Apr 25, 2024
1 parent 8ea9669 commit 8243ea3
Show file tree
Hide file tree
Showing 51 changed files with 335 additions and 236 deletions.
1 change: 1 addition & 0 deletions package-lock.json

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

28 changes: 14 additions & 14 deletions packages/database/migrations/20240129091246_common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,40 @@ export const createTable = async (
};

export const baseRecord = (knex: Knex, t: Knex.CreateTableBuilder) => {
t.text('uid');
t.text('project');
t.string('uid');
t.string('project');
t.timestamp('createdOn').defaultTo(knex.raw('CURRENT_TIMESTAMP'));
t.timestamp('updatedOn').defaultTo(knex.raw('CURRENT_TIMESTAMP'));
t.text('createdBy');
t.string('createdBy');
t.primary(['uid']);
};

export const baseSubCollection = (knex: Knex, t: Knex.CreateTableBuilder) => {
t.text('uid');
t.text('parentId');
t.text('project');
t.string('uid');
t.string('parentId');
t.string('project');
t.timestamp('createdOn').defaultTo(knex.raw('CURRENT_TIMESTAMP'));
t.timestamp('updatedOn').defaultTo(knex.raw('CURRENT_TIMESTAMP'));
t.text('createdBy');
t.string('createdBy');
t.primary(['uid', 'parentId']);
};

export const mintingData = (t: Knex.CreateTableBuilder, base = 'mintingData_') => {
t.text(base + 'address');
t.string(base + 'address');
t.string(base + 'network');

t.timestamp(base + 'mintedOn');
t.text(base + 'mintedBy');
t.string(base + 'mintedBy');

t.text(base + 'blockId');
t.text(base + 'nftId');
t.string(base + 'blockId');
t.string(base + 'nftId');
t.double(base + 'storageDeposit');

t.text(base + 'aliasBlockId');
t.text(base + 'aliasId');
t.string(base + 'aliasBlockId');
t.string(base + 'aliasId');
t.double(base + 'aliasStorageDeposit');

t.text(base + 'mintingOrderId');
t.string(base + 'mintingOrderId');

t.double(base + 'nftsToMint');
t.double(base + 'nftMediaToUpload');
Expand Down
8 changes: 4 additions & 4 deletions packages/database/migrations/20240129135000_auction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { baseRecord, createTable } from './20240129091246_common';
export async function up(knex: Knex): Promise<void> {
await createTable(knex, COL.AUCTION, undefined, (table) => {
baseRecord(knex, table);
table.text('space');
table.string('space');
table.timestamp('auctionFrom');
table.timestamp('auctionTo');
table.double('auctionLength');
Expand All @@ -14,13 +14,13 @@ export async function up(knex: Knex): Promise<void> {
table.double('extendAuctionWithin');
table.double('auctionFloorPrice');
table.double('minimalBidIncrement');
table.text('auctionHighestBidder');
table.string('auctionHighestBidder');
table.double('auctionHighestBid');
table.double('maxBids');
table.string('type');
table.string('network');
table.text('nftId');
table.text('targetAddress');
table.string('nftId');
table.string('targetAddress');
table.boolean('active');
table.boolean('topUpBased');

Expand Down
34 changes: 17 additions & 17 deletions packages/database/migrations/20240129135000_award.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export async function up(knex: Knex): Promise<void> {
await createTable(knex, COL.AWARD, undefined, (table) => {
baseRecord(knex, table);

table.text('name');
table.string('name');
table.text('description');
table.text('space');
table.string('space');
table.timestamp('endDate');
table.double('issued');
table.double('badgesMinted');
Expand All @@ -21,29 +21,29 @@ export async function up(knex: Knex): Promise<void> {
table.double('nttStorageDeposit');
table.double('nativeTokenStorageDeposit');
table.boolean('funded');
table.text('fundingAddress');
table.text('fundedBy');
table.text('address');
table.string('fundingAddress');
table.string('fundedBy');
table.string('address');
table.double('airdropClaimed');
table.text('aliasBlockId');
table.text('aliasId');
table.text('collectionBlockId');
table.text('collectionId');
table.string('aliasBlockId');
table.string('aliasId');
table.string('collectionBlockId');
table.string('collectionId');
table.string('mediaStatus');
table.double('mediaUploadErrorCount');
table.boolean('isLegacy');
table.text('badge_name');
table.string('badge_name');
table.text('badge_description');
table.double('badge_total');
table.string('badge_type');
table.double('badge_tokenReward');
table.text('badge_tokenUid');
table.text('badge_tokenId');
table.text('badge_tokenSymbol');
table.text('badge_image');
table.text('badge_ipfsMedia');
table.text('badge_ipfsMetadata');
table.text('badge_ipfsRoot');
table.string('badge_tokenUid');
table.string('badge_tokenId');
table.string('badge_tokenSymbol');
table.string('badge_image');
table.string('badge_ipfsMedia');
table.string('badge_ipfsMetadata');
table.string('badge_ipfsRoot');
table.double('badge_lockTime');
});

Expand Down
18 changes: 7 additions & 11 deletions packages/database/migrations/20240129135000_collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ export async function up(knex: Knex): Promise<void> {

await createTable(knex, COL.COLLECTION, undefined, (table) => {
baseRecord(knex, table);
table.text('name');
table.string('name');
table.text('description');
table.text('bannerUrl');
table.double('royaltiesFee');
table.text('royaltiesSpace');
table.string('royaltiesSpace');

table.double('total');
table.double('totalTrades');
Expand All @@ -33,26 +33,22 @@ export async function up(knex: Knex): Promise<void> {
table.boolean('approved');
table.boolean('rejected');
table.boolean('limitedEdition');
table.text('ipfsMedia');
table.text('ipfsMetadata');
table
.text('ipfsRoot')
.comment(
'IPFS link to root directory that contains both {@link ipfsMedia} & {@link ipfsMetadata}',
);
table.string('ipfsMedia');
table.string('ipfsMetadata');
table.string('ipfsRoot');

table.string('category');
table.integer('type');
table.integer('access');
table.specificType('accessAwards', 'TEXT[]').defaultTo('{}');
table.specificType('accessCollections', 'TEXT[]').defaultTo('{}');

table.text('space');
table.string('space');
table.timestamp('availableFrom');
table.double('price');
table.double('availablePrice');
table.boolean('onePerMemberOnly');
table.text('placeholderNft');
table.string('placeholderNft');
table.text('placeholderUrl');
table.string('status');

Expand Down
14 changes: 7 additions & 7 deletions packages/database/migrations/20240129135000_member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import { baseRecord, createTable } from './20240129091246_common';
export async function up(knex: Knex): Promise<void> {
await createTable(knex, COL.MEMBER, undefined, (table) => {
baseRecord(knex, table);
table.text('nonce');
table.text('name');
table.string('nonce');
table.string('name');
table.text('about');
table.text('avatarNft');
table.string('avatarNft');
table.text('avatar');
table.text('discord');
table.text('twitter');
table.text('github');

table.text('smrAddress').defaultTo('');
table.text('rmsAddress').defaultTo('');
table.text('iotaAddress').defaultTo('');
table.text('atoiAddress').defaultTo('');
table.string('smrAddress').defaultTo('');
table.string('rmsAddress').defaultTo('');
table.string('iotaAddress').defaultTo('');
table.string('atoiAddress').defaultTo('');

table.specificType('prevValidatedAddresses', 'TEXT[]').defaultTo('{}');
table.double('tokenTradingFeePercentage');
Expand Down
2 changes: 1 addition & 1 deletion packages/database/migrations/20240129135000_mnemonic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function up(knex: Knex): Promise<void> {
baseRecord(knex, table);
table.text('mnemonic');
table.string('network');
table.text('lockedBy').defaultTo('');
table.string('lockedBy').defaultTo('');
table.specificType('consumedOutputIds', 'TEXT[]').defaultTo('{}');
table.specificType('consumedNftOutputIds', 'TEXT[]').defaultTo('{}');
table.specificType('consumedAliasOutputIds', 'TEXT[]').defaultTo('{}');
Expand Down
20 changes: 10 additions & 10 deletions packages/database/migrations/20240129135000_nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { baseRecord, createTable, mintingData } from './20240129091246_common';
export async function up(knex: Knex): Promise<void> {
await createTable(knex, COL.NFT, undefined, (table) => {
baseRecord(knex, table);
table.text('name');
table.string('name');
table.text('description');
table.text('collection');
table.text('owner');
table.string('collection');
table.string('owner');
table.boolean('isOwned');
table.text('media');
table.text('ipfsMedia');
table.text('ipfsMetadata');
table.text('ipfsRoot');
table.string('ipfsMedia');
table.string('ipfsMetadata');
table.string('ipfsRoot');
table.integer('saleAccess');
table.specificType('saleAccessMembers', 'TEXT[]').defaultTo('{}');
table.integer('available');
Expand All @@ -22,7 +22,7 @@ export async function up(knex: Knex): Promise<void> {
table.timestamp('auctionTo');
table.timestamp('extendedAuctionTo');
table.double('auctionHighestBid');
table.text('auctionHighestBidder');
table.string('auctionHighestBidder');
table.double('price');
table.double('totalTrades');
table.timestamp('lastTradedOn');
Expand All @@ -33,7 +33,7 @@ export async function up(knex: Knex): Promise<void> {
table.double('extendAuctionWithin');

table.integer('type');
table.text('space');
table.string('space');
table.text('url');
table.boolean('approved');
table.boolean('rejected');
Expand All @@ -42,7 +42,7 @@ export async function up(knex: Knex): Promise<void> {
table.boolean('placeholderNft');
table.double('position');
table.boolean('locked');
table.text('lockedBy');
table.string('lockedBy');
table.boolean('sold');
mintingData(table);
mintingData(table, 'depositData_');
Expand All @@ -52,7 +52,7 @@ export async function up(knex: Knex): Promise<void> {
table.double('mediaUploadErrorCount');
table.timestamp('soldOn');
table.boolean('setAsAvatar');
table.text('auction');
table.string('auction');
});
}

Expand Down
8 changes: 4 additions & 4 deletions packages/database/migrations/20240129135000_nft_stake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { baseRecord, createTable } from './20240129091246_common';
export async function up(knex: Knex): Promise<void> {
await createTable(knex, COL.NFT_STAKE, undefined, (table) => {
baseRecord(knex, table);
table.text('member');
table.text('space');
table.text('collection');
table.text('nft');
table.string('member');
table.string('space');
table.string('collection');
table.string('nft');
table.double('weeks');
table.timestamp('expiresAt');
table.boolean('expirationProcessed');
Expand Down
4 changes: 2 additions & 2 deletions packages/database/migrations/20240129135000_notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export async function up(knex: Knex): Promise<void> {
await createTable(knex, COL.NOTIFICATION, undefined, (table) => {
baseRecord(knex, table);

table.text('space');
table.text('member');
table.string('space');
table.string('member');
table.string('type');
table.jsonb('params').defaultTo({});
});
Expand Down
10 changes: 5 additions & 5 deletions packages/database/migrations/20240129135000_project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export async function up(knex: Knex): Promise<void> {
await createTable(knex, COL.PROJECT, undefined, (table) => {
baseRecord(knex, table);

table.text('name');
table.text('contactEmail');
table.string('name');
table.string('contactEmail');
table.boolean('deactivated');
table.string('config_billing');
table.specificType('config_tiers', 'FLOAT[]');
table.specificType('config_tokenTradingFeeDiscountPercentage', 'FLOAT[]');
table.text('config_nativeTokenSymbol');
table.text('config_nativeTokenUid');
table.string('config_nativeTokenSymbol');
table.string('config_nativeTokenUid');
table.jsonb('otr').defaultTo({});
});

Expand All @@ -23,7 +23,7 @@ export async function up(knex: Knex): Promise<void> {

await createTable(knex, COL.PROJECT, SUB_COL._API_KEY, (table) => {
baseSubCollection(knex, table);
table.text('token');
table.string('token');
});
}

Expand Down
16 changes: 8 additions & 8 deletions packages/database/migrations/20240129135000_proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function up(knex: Knex): Promise<void> {
baseSubCollection(knex, t);
t.boolean('voted');
t.double('weight');
t.text('tranId');
t.string('tranId');
t.jsonb('values').defaultTo({});
});

Expand All @@ -17,25 +17,25 @@ export async function up(knex: Knex): Promise<void> {

await createTable(knex, COL.PROPOSAL, undefined, (t) => {
baseRecord(knex, t);
t.text('space');
t.text('name');
t.string('space');
t.string('name');
t.text('description');
t.text('additionalInfo');
t.integer('type');
t.boolean('approved');
t.boolean('rejected');
t.text('approvedBy');
t.text('rejectedBy');
t.text('eventId');
t.string('approvedBy');
t.string('rejectedBy');
t.string('eventId');
t.double('totalWeight');
t.text('token');
t.string('token');
t.boolean('completed');
t.double('rank');

t.timestamp('settings_startDate');
t.timestamp('settings_endDate');
t.boolean('settings_guardiansOnly');
t.text('settings_addRemoveGuardian');
t.string('settings_addRemoveGuardian');
t.jsonb('settings_spaceUpdateData').defaultTo({});
t.boolean('settings_onlyGuardians');
t.specificType('settings_stakeRewardIds', 'TEXT[]').defaultTo('{}');
Expand Down
8 changes: 4 additions & 4 deletions packages/database/migrations/20240129135000_soon_snap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { baseRecord, createTable } from './20240129091246_common';
export async function up(knex: Knex): Promise<void> {
await createTable(knex, COL.SOON_SNAP, undefined, (t) => {
baseRecord(knex, t);
t.double('count').notNullable();
t.double('paidOut').notNullable();
t.double('count');
t.double('paidOut');
t.timestamp('lastPaidOutOn');
t.text('ethAddress').notNullable();
t.boolean('ethAddressVerified').notNullable();
t.string('ethAddress');
t.boolean('ethAddressVerified');
});
}

Expand Down
Loading

0 comments on commit 8243ea3

Please sign in to comment.