Commit Graph

57 Commits

Author SHA1 Message Date
Sam Lord
356256067c Data generator: Ensure order of newsletters is correct
no issue
2023-08-04 13:36:09 +01:00
Sam Lord
4ff467794f Entirely rewrote data generator to simplify codebase
refs: https://github.com/TryGhost/DevOps/issues/11

This is a pretty huge commit, but the relevant points are:
* Each importer no longer needs to be passed a set of data, it just gets the data it needs
* Each importer specifies its dependencies, so that the order of import can be determined at runtime using a topological sort
* The main data generator function can just tell each importer to import the data it has

This makes working on the data generator much easier.

Some other benefits are:
* Batched importing, massively speeding up the whole process
* `--tables` to set the exact tables you want to import, and specify the quantity of each
2023-08-04 13:36:09 +01:00
renovate[bot]
7dce046786 Update Test & linting packages 2023-07-11 15:26:07 +02:00
Fabien "egg" O'Carroll
104f84f252 Added eslint rule for file naming convention
As discussed with the product team we want to enforce kebab-case file names for
all files, with the exception of files which export a single class, in which
case they should be PascalCase and reflect the class which they export.

This will help find classes faster, and should push better naming for them too.

Some files and packages have been excluded from this linting, specifically when
a library or framework depends on the naming of a file for the functionality
e.g. Ember, knex-migrator, adapter-manager
2023-05-09 12:34:34 -04:00
Sam Lord
cb30c9bbc9 Prevent posts_meta data from killing the data-generator process
no issue
2023-05-03 16:28:29 +01:00
Sam Lord
f7188b4dcf Prevented an invalid order during deletion
no issue

Will allow the demo data script to run if offers exist and have been redeemed
2023-05-02 16:34:47 +01:00
renovate[bot]
07545541a8 Update @tryghost 2023-04-07 13:47:12 +02:00
renovate[bot]
83373e1751 Update Test & linting packages 2023-04-05 15:16:08 +02:00
Sam Lord
1d7572fed5 Data generator: Fixed the URL formatting for newsletter clicks
no issue
2023-03-30 16:49:19 +01:00
Sam Lord
661de46ae0 Fixed the reply-to address for newsletters in data generator
no issue

This makes it so that newsletters can be manipulated in Ghost Admin, otherwise Ember errors
2023-03-22 14:56:51 +00:00
Sam Lord
d04b43aeee Added post-based attributions for members in data-generator
no issue
2023-03-16 10:17:14 +00:00
Sam Lord
72ba6ec4af Added member feedback to data generator
refs: https://github.com/TryGhost/Toolbox/issues/454
2023-03-14 10:32:34 +00:00
renovate[bot]
2223db5379
Update Test & linting packages 2023-03-13 02:36:20 +00:00
renovate[bot]
b93b38a8e8 Update @tryghost 2023-03-10 09:52:02 +01:00
Daniel Lockyer
6b1966ad9b Updated sinon dependency
- this is being done manually instead of merging the Renovate PR because
  the PR bundles another bump which doesn't pass yet
2023-03-02 12:43:42 +01:00
renovate[bot]
9f08732039 Update @tryghost 2023-03-02 09:47:02 +01:00
Sam Lord
98f0b6c7ce Added ghost_subscription_id to members_stripe_customers_subscriptions table in data generator
no issue
2023-02-28 11:14:11 +00:00
Sam Lord
9852c21ec5 Prevented random labels from being generated when base-data is present
no issue

Before, when base data included labels for members, the random generated labels would also be generated. This prevents that, and ensures that the base-data labels are applied correctly to members.
2023-02-23 11:04:58 +00:00
Sam Lord
c72dcd629f Fixed balance of email recipient data in data generator
no issue

Previously the number of opened emails was being generated incorrectly as the number of delivered emails was being reported too high.

Also, the faker date function occasionally fails for dates which are
too close together so this switches to manually generating a date
between the two.
2023-02-21 23:50:02 +00:00
Sam Lord
6cdf37c0ee Added open rates to members in data generator
no issue
2023-02-21 23:50:02 +00:00
Sam Lord
522652e99e Prevent duplicate label names in data generator
no issue
2023-02-21 11:42:33 +00:00
Sam Lord
744b92333c Fixed members-click-event created_at time
no issue
The faker date method seems to spontaneously fail sometimes, as it had decided that the "later" time was before the opened time.
2023-02-20 15:46:47 +00:00
Sam Lord
25eaf05395 Made data generator import labels from the base pack when specified
no issue

This will allow us to use a custom (non-random) set of labels, which should look more realistic.
2023-02-20 12:02:44 +00:00
Sam Lord
70e2c07f2e Data generator: Ensure user roles are only generated if roles already exist
no issue

Fixes the build, as in the test environment there are no user roles
2023-02-20 11:06:18 +00:00
Sam Lord
37f16b1b17 Added roles to users in data generator
no issue
2023-02-20 09:26:28 +00:00
Sam Lord
36ea0cc6d6 Added labels to data-generator
no issue
2023-02-20 09:26:28 +00:00
Sam Lord
db7ac14467 Added offers to data generator
no issue

Can generate a pair of offers.

TODO: Add offers to the base-data pack
2023-02-20 09:26:28 +00:00
Sam Lord
22ac685354 Added pages to data-generator
no issue

Data generator will now add 3 pages by default - can add extra support here, e.g. webmentions later.
2023-02-20 09:26:28 +00:00
Sam Lord
c6e119ecf5 Allow data-generator to make scheduled and draft posts
no issue

Also adds visiblity options, paid, members-only and public
2023-02-20 09:26:28 +00:00
Sam Lord
10a4a8eb12 Fixed tests for demo-data
no issue
2023-02-17 15:08:01 +00:00
Sam Lord
ca395a958c Added post analytics to data generator
no issue
2023-02-17 14:03:59 +00:00
renovate[bot]
cf7ecb492c
Update dependency c8 to v7.13.0 2023-02-16 22:15:50 +00:00
Sam Lord
b4c90bf07d Reduced number of login events in large-scale data generation
no issue

This should massively increase the speed of importing for the large dataset, which is important as the time to import it on Pro is >10 minutes at the moment
2023-02-16 20:54:14 +00:00
Sam Lord
b8f59f07f2 Added --clear-database option to make it easier to use the data generator
no issue
2023-02-16 12:11:08 +00:00
Sam Lord
9e42d1356a Updated avatar styles for webmentions
no issue

This makes the style for generated webmentions much better.
2023-02-13 13:16:24 +00:00
Fabien 'egg' O'Carroll
4e8af72305
Added support for deleting mentions (#16238)
refs https://github.com/TryGhost/Team/issues/2534

As we're using soft deletes for mentions we need to store the `deleted` column
as well as enforce a `'deleted:false'` filter on the bookshelf model. 

We've also implemented the handling for deleting mentions. Where we remove a
mention anytime we receive and update from or to a page which no longer exists.

Co-authored-by: Steve Larson <9larsons@gmail.com>
2023-02-09 17:29:13 +07:00
Sam Lord
0d7944861c Data generator: Swap order of free and premium newsletters
no issue
Free and premium newsletters were the other way around in the demo-data. This was a good opportunity to stop the email table importer from relying on the newsletter name, and use the order alone.
2023-02-08 22:12:19 +00:00
Sam Lord
e0bcb26600 Improved data-generator tooling
no issue

This makes the data-generator more customisable.
2023-02-06 10:42:56 +00:00
Sam Lord
1c0a0e0549 Added email table to data generator
refs: https://github.com/TryGhost/Toolbox/issues/454
2023-02-01 11:58:20 +00:00
Sam Lord
24bdcf5e9d Added WebMentions to data generator
closes: https://github.com/TryGhost/Toolbox/issues/509
closes: https://github.com/TryGhost/Toolbox/issues/507
2023-01-23 17:39:00 +00:00
renovate[bot]
929d32dddf Update dependency knex to v2.4.2 2023-01-23 13:00:53 +01:00
renovate[bot]
28ed23c13e Update dependency knex to v2.4.1 2023-01-18 07:43:07 +01:00
renovate[bot]
608d4eb6d2 Update dependency knex to v2.4.0 2023-01-06 19:11:14 +01:00
Daniel Lockyer
08b786af3b Bumped TryGhost-owned dependencies and lockfile
- this was all getting terribly behind so I've done several things:
  - majority of `@tryghost/*` except Lexical packages
  - gscan + knex-migrator to remove old `@tryghost/errors` usage
  - bumped lockfile
2023-01-02 20:55:22 +01:00
Sam Lord
994e546787 Prevented posts meta table from breaking data generator script
refs: https://github.com/TryGhost/Toolbox/issues/453
2023-01-02 16:45:45 +00:00
Daniel Lockyer
6f4e663d74
Updated @tryghost dependencies (#16005)
- also includes `knex-migrator` with a simple `sqlite3` bump
2022-12-14 11:18:55 +07:00
renovate[bot]
13abcf6c9d
Update dependency mocha to v10.2.0 2022-12-12 13:20:22 +00:00
renovate[bot]
8fa9f1e7e6
Update Test & linting packages 2022-11-07 20:39:48 +00:00
Hannah Wolfe
b3cafff924
Fixed duplicate settings error from data generator
- clear the settings table down before importing
- maybe we don't need to splat them all... but for now this makes importing work on top of a freshly provisioned DB
2022-11-07 16:53:02 +00:00
Hannah Wolfe
dc6b308e37
Added extra logging to improve dev exp
- this takes a while, but it was hard to tell what the script was doing and if I should still wait
- tried to make it a little clearer, and have a green message at the end
2022-11-07 16:53:01 +00:00