Feature: Adds createdAt, updatedAt and siteId columns in postgres#45
Open
manuelurenah wants to merge 14 commits intomasterfrom
Open
Feature: Adds createdAt, updatedAt and siteId columns in postgres#45manuelurenah wants to merge 14 commits intomasterfrom
manuelurenah wants to merge 14 commits intomasterfrom
Conversation
…g created_at and updated_at columns in the schema
james-owen
reviewed
Jun 6, 2019
| $$ LANGUAGE plpgsql; | ||
|
|
||
| ALTER TABLE IF EXISTS uris | ||
| ADD COLUMN IF NOT EXISTS created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), |
Member
There was a problem hiding this comment.
I think the NOT NULL constraint on these columns has the potential to have a major performance penalty in postgres versions before 11. If anyone is running an earlier version, we'll have to break this step down in to a few steps.
james-owen
reviewed
Jun 27, 2019
Member
james-owen
left a comment
There was a problem hiding this comment.
I think this change would require dropping the migrations table and rebuilding it.
| var commands = [], url; | ||
|
|
||
| for (let i = 0; i < ops.length; i++) { | ||
| for (let i = 0, opsLength = ops.length; i < opsLength; i++) { |
There was a problem hiding this comment.
Why are we using opsLength here and not ops.length?
Contributor
Author
There was a problem hiding this comment.
This is done for loop optimization, we assign the value of length to a property to avoid having to look it up at every iteration. You can read more about it here: https://jaysoo.ca/2009/12/23/javascript-optimizing-loops/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
QA
In order to be able to test this feature, you should link this package and clay/amphora#665 in a clay project. I've been using https://github.com/clay/clay-starter to develop this feature, that's a good starting point.
Testing steps
clay-starter)makeadmineris up and running usingdocker-compose up -d adminerappdirectory (or where thepackage.jsonfile is located) and link the previously mentioned packages withnpm link amphora && npm link amphora-storage-postgres(make sure the packages are in the correct branch and linked)rs. After it's done, you should a message statingMigrations Completepostgres; password isexample)created_at, which should default to the date the row was created;updated_at, which should default to the date the row was created and update itself if the data changes; andsite_id, which should contain the site slugmake boostrap(where theMakefileis located)