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

JIT-29004: Enable and disable TTL support #1

Merged
merged 5 commits into from
Jan 17, 2020
Merged

JIT-29004: Enable and disable TTL support #1

merged 5 commits into from
Jan 17, 2020

Conversation

hiradp
Copy link

@hiradp hiradp commented Dec 6, 2019

Here's a sample migration that enables TTLs on table projectsHistoryTable on the column name ttl

'use strict';

var tableName = require('./cs_tables').projectsHistoryTable;

exports.up = function(migrator, config){
  return migrator().enableTTL(tableName, 'ttl');
};

exports.down = function(migrator, config){
  return migrator().disableTTL(tableName, 'ttl');
};

@tmercswims
Copy link
Member

With this implementation, is it possible to enable TTL in the same migration which creates the table?

@hiradp
Copy link
Author

hiradp commented Dec 6, 2019

@tmercswims Unfortunately not. As far as my understanding goes, that's a limitation of the aws-sdk. Modifying a TTL attribute is a different call and requires a table name, which implies that the table needs to exist.

Here's what the create table parameters look like

{
    TableName : "Music",
    KeySchema: [       
        { 
            AttributeName: "Artist", 
            KeyType: "HASH", //Partition key
        },
        { 
            AttributeName: "SongTitle", 
            KeyType: "RANGE" //Sort key
        }
    ],
    AttributeDefinitions: [
        { 
            AttributeName: "Artist", 
            AttributeType: "S" 
        },
        { 
            AttributeName: "SongTitle", 
            AttributeType: "S" 
        }
    ],
    ProvisionedThroughput: {       // Only specified if using provisioned mode
        ReadCapacityUnits: 1, 
        WriteCapacityUnits: 1
    }
}

There isn't a place where I can specify that.

Also @tmercswims, @sean-krail, should we remove Travis and go with GitHub actions since this is a public repo anyways?

@tmercswims
Copy link
Member

Gotcha, understood.

And yes, I think we should. I'm already working on a branch to move over.

sean-krail
sean-krail previously approved these changes Dec 10, 2019
createMigrateTableIfNotExists now works when there are more than 100 …
@tmercswims tmercswims merged commit 2aaa7f2 into master Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants