Some more fixes in sources for fields

This commit is contained in:
Tomas Bures 2018-11-24 06:58:14 +01:00
parent 106acd0656
commit fa451fc8da
4 changed files with 6 additions and 5 deletions

View file

@ -75,7 +75,7 @@ export default class CUD extends Component {
homepage: '',
unsubscription_mode: UnsubscriptionMode.ONE_STEP,
namespace: mailtrainConfig.user.namespace,
to_name: '[FIRST_NAME] [LAST_NAME]',
to_name: '[MERGE_FIRST_NAME] [MERGE_LAST_NAME]',
send_configuration: null,
listunsubscribe_disabled: false
});

View file

@ -551,7 +551,7 @@ async function create(context, listId, entity) {
}
});
// Altough this is a reference to another list, it is represented as signed int(11). This is because we use negative values for constant from SubscriptionSource
// Altough this is a reference to an import, it is represented as signed int(11). This is because we use negative values for constant from SubscriptionSource
await knex.schema.raw('ALTER TABLE `subscription__' + listId + '` ADD `source_' + columnName +'` int(11) DEFAULT NULL');
}
@ -600,6 +600,7 @@ async function removeTx(tx, context, listId, id) {
} else {
await knex.schema.table('subscription__' + listId, table => {
table.dropColumn(existing.column);
table.dropColumn('source_' + existing.column);
});
await segments.removeRulesByColumnTx(tx, context, listId, existing.column);

View file

@ -123,7 +123,7 @@ async function create(context, entity) {
' `cid` varchar(255) CHARACTER SET ascii NOT NULL,\n' +
' `email` varchar(255) CHARACTER SET utf8 DEFAULT NULL,\n' +
' `hash_email` varchar(255) CHARACTER SET ascii NOT NULL,\n' +
' `source_email` int(10) unsigned,\n' + // This references imports if the source is an import, 0 means some import in version 1, NULL if the source is via subscription or edit of the subscription
' `source_email` int(11) DEFAULT NULL,\n' + // Altough this is a reference to an import, it is represented as signed int(11). This is because we use negative values for constant from SubscriptionSource
' `opt_in_ip` varchar(100) DEFAULT NULL,\n' +
' `opt_in_country` varchar(2) DEFAULT NULL,\n' +
' `tz` varchar(100) CHARACTER SET ascii DEFAULT NULL,\n' +

View file

@ -242,7 +242,7 @@ async function migrateSubscriptions(knex) {
const lists = await knex('lists');
for (const list of lists) {
await knex.schema.raw('ALTER TABLE `subscription__' + list.id + '` ADD `unsubscribed` timestamp NULL DEFAULT NULL');
await knex.schema.raw('ALTER TABLE `subscription__' + list.id + '` ADD `source_email` int(10) unsigned DEFAULT NULL');
await knex.schema.raw('ALTER TABLE `subscription__' + list.id + '` ADD `source_email` int(11) DEFAULT NULL');
await knex.schema.raw('ALTER TABLE `subscription__' + list.id + '` ADD `hash_email` varchar(255) CHARACTER SET ascii');
@ -250,7 +250,7 @@ async function migrateSubscriptions(knex) {
const info = await knex('subscription__' + list.id).columnInfo();
for (const field of fields) {
if (field.column != null) {
// Altough this is a reference to another list, it is represented as signed int(11). This is because we use negative values for constant from SubscriptionSource
// Altough this is a reference to an import, it is represented as signed int(11). This is because we use negative values for constant from SubscriptionSource
await knex.schema.raw('ALTER TABLE `subscription__' + list.id + '` ADD `source_' + field.column +'` int(11) DEFAULT NULL');
}