2013-12-10 5 views

risposta

8

Si può anche provare qualcosa di simile:

module.exports = { 

    // migrate: 'alter', // adds and/or removes columns on changes to the schema 

    // migrate: 'drop', // drops all your tables and then re-creates them. All data is deleted. 

    // migrate: 'safe', doesn't do anything on sails lift- for use in production. 

    attributes: { /* ... */ } 

}; 
+0

Vedi anche https://github.com/ balderdashy/sails/issues/1471 # issuecomment-36668189 – mikermcneil

+0

@mikermcneil, ho provato ad usarlo ma dopo alcuni giorni i miei dati sono svaniti in qualche modo, non so come, uso questo comando per sempre -w start -al/var/log/mylog.log --prod – Sahan

+0

Qualsiasi t houghts @mikermcneil ,, – Sahan

4

Possiamo ottenere ciò specificando la proprietà migrate nel modello. Il suo valore predefinito è alter che tenta di eseguire automaticamente la migrazione dello schema ad ogni modifica.

module.exports = { 
    schema: true, 
    migrate: 'safe', 
    adapter: 'mysql', 

    attributes: {} 
} 
2

Per tutti i modelli è possibile modificare in confing/models.js

migrate: 'safe', 
Problemi correlati