Last active
February 1, 2018 19:40
-
-
Save david-bc/795f91eebe914957427d62ec601c77fe to your computer and use it in GitHub Desktop.
This file contains 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
const pad = (v, len) => _.padStart(v, len, '0') | |
const pName = d => `p${d.getFullYear()}${pad(d.getMonth() + 1, 2)}${pad(d.getDate(), 2)}` | |
const line = d => ` PARTITION ${pName(d)} VALUES LESS THAN (${d.getTime()}),` | |
let curr = new Date(2018, 0, 1) | |
_.range(365).map(i => line(new Date(curr.getFullYear(), curr.getMonth(), curr.getDate() + i))).join('\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment