Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed potential payment ads migration #951

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/migrate-down-all.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
psql $DATABASE_URL -U eyeshade --single-transaction -v ON_ERROR_STOP=1 -f ./migrations/0020_remove_potential_payments_ads/down.sql
psql $DATABASE_URL -U eyeshade --single-transaction -v ON_ERROR_STOP=1 -f ./migrations/0019_add_inserted_at/down.sql
psql $DATABASE_URL -U eyeshade --single-transaction -v ON_ERROR_STOP=1 -f ./migrations/0018_add_snapshot_index/down.sql
psql $DATABASE_URL -U eyeshade --single-transaction -v ON_ERROR_STOP=1 -f ./migrations/0017_include_indexes/down.sql
Expand Down
2 changes: 1 addition & 1 deletion eyeshade/migrations/0008_on_delete_cascade/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ select execute($$
insert into migrations (id, description) values ('0008', 'on_delete_cascade');

ALTER TABLE potential_payments_ads
DROP CONSTRAINT potential_payments_ads_payout_report_id_fkey;
DROP CONSTRAINT if exists potential_payments_ads_payout_report_id_fkey;

ALTER TABLE potential_payments_ads
ADD CONSTRAINT cascade_payout_report_id
Expand Down
2 changes: 1 addition & 1 deletion eyeshade/migrations/0009_unique_payment_ids/down.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ select execute($$
delete from migrations where id = '0009';

alter table potential_payments_ads
drop constraint unique_payment_id_payout_report_id;
drop constraint if exists unique_payment_id_payout_report_id;

$$) where exists (select * from migrations where id = '0009');

2 changes: 0 additions & 2 deletions eyeshade/migrations/0019_add_inserted_at/down.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ select execute($$
alter table if exists transactions
drop column if exists inserted_at;

drop index if exists transactions_inserted_at;

delete from migrations where id = '0019';

$$) where exists (select * from migrations where id = '0019');
19 changes: 19 additions & 0 deletions eyeshade/migrations/0020_remove_potential_payments_ads/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
select execute($$

delete from migrations where id = '0020';

create table payout_reports_ads(
id uuid primary key default uuid_generate_v4(),
created_at timestamp with time zone not null default current_timestamp
);

create table potential_payments_ads(
id uuid primary key default uuid_generate_v4(),
payout_report_id uuid not null references payout_reports_ads(id),
payment_id uuid not null,
provider_id uuid not null,
amount numeric(28, 18) not null check (amount > 0.0),
created_at timestamp with time zone not null default current_timestamp
);

$$) where exists (select * from migrations where id = '0020');
7 changes: 7 additions & 0 deletions eyeshade/migrations/0020_remove_potential_payments_ads/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
select execute($$

drop table potential_payments_ads;
drop table payout_reports_ads;
insert into migrations (id, description) values ('0020', 'remove_potential_payments_ads');

$$) where not exists (select * from migrations where id = '0020');
2 changes: 0 additions & 2 deletions eyeshade/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const referralsWorker = require('./workers/referrals')
const reportsWorker = require('./workers/reports')
const surveyorsWorker = require('./workers/surveyors')
const walletWorker = require('./workers/wallet')
const adsWorker = require('./workers/ads')
const snapshotsWorker = require('./workers/snapshots')

const {
Expand All @@ -30,7 +29,6 @@ const parentModules = [
reportsWorker,
surveyorsWorker,
walletWorker,
adsWorker,
snapshotsWorker
]

Expand Down
65 changes: 0 additions & 65 deletions eyeshade/workers/ads.js

This file was deleted.

62 changes: 0 additions & 62 deletions test/eyeshade/ads.integration.test.js

This file was deleted.

34 changes: 0 additions & 34 deletions test/eyeshade/migrations.test.js

This file was deleted.

2 changes: 0 additions & 2 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ function cleanPgDb (postgres) {
const client = await postgres.connect()
try {
await Promise.all([
client.query('DELETE from payout_reports_ads;'),
client.query('DELETE from potential_payments_ads;'),
client.query('DELETE from transactions;'),
client.query('DELETE from surveyor_groups;'),
client.query('DELETE from geo_referral_countries;'),
Expand Down