mirror of
https://github.com/strapi/strapi.git
synced 2025-11-09 22:59:14 +00:00
update : convly request applied
This commit is contained in:
parent
11923a820f
commit
83ca415e9d
@ -14,6 +14,13 @@ const validateInput = (input) => {
|
|||||||
return regex.test(input) || "Please use only letters and number, '-' or '_' and no spaces";
|
return regex.test(input) || "Please use only letters and number, '-' or '_' and no spaces";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getFormattedDate = (date = new Date()) => {
|
||||||
|
return new Date(date.getTime() - date.getTimezoneOffset() * 60000)
|
||||||
|
.toISOString()
|
||||||
|
.split(".")[0]
|
||||||
|
.replace(/[-T:]/g, "_");
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = (plop) => {
|
module.exports = (plop) => {
|
||||||
// Migration generator
|
// Migration generator
|
||||||
plop.setGenerator('migration', {
|
plop.setGenerator('migration', {
|
||||||
@ -29,7 +36,7 @@ module.exports = (plop) => {
|
|||||||
actions(answers) {
|
actions(answers) {
|
||||||
const currentDir = process.cwd();
|
const currentDir = process.cwd();
|
||||||
const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
|
const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
|
||||||
const timestamp = moment().format('YYYY_MM_DD_HH_mm_ss');
|
const timestamp = getFormattedDate();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { Knex } from 'knex';
|
import type { Knex } from 'knex';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Migration `{{ id }}`
|
* Migration `{{ id }}`
|
||||||
|
|||||||
@ -36,8 +36,7 @@
|
|||||||
"fs-extra": "10.0.0",
|
"fs-extra": "10.0.0",
|
||||||
"node-plop": "0.26.3",
|
"node-plop": "0.26.3",
|
||||||
"plop": "2.7.6",
|
"plop": "2.7.6",
|
||||||
"pluralize": "8.0.0",
|
"pluralize": "8.0.0"
|
||||||
"moment": "^2.29.4"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.19.1 <=18.x.x",
|
"node": ">=14.19.1 <=18.x.x",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user