Created
April 11, 2013 19:04
-
-
Save corbanbrook/5366257 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class SoftchoiceAddAnalyticsScript < PresslyMigrator::Seed | |
| def self.up | |
| account = Account.where(uid: 'softchoice').first | |
| file_path = PresslyDashboard.root.join('db/scripts/softchoice/msgapp.js') | |
| source = File.read(file_path) | |
| if account && (site = account.sites.where(uid: 'link').first) | |
| # install analytics script for both apps | |
| site.apps.each do |app| | |
| Property::Script.create!({ | |
| app: app, | |
| name: 'msgapp', | |
| type: 'js', | |
| source: source, | |
| category: 'plugin' | |
| }) | |
| end | |
| end | |
| end | |
| def self.down | |
| account = Account.where(uid: 'softchoice').first | |
| if account && (site = account.sites.where(uid: 'link').first) | |
| site.apps.each do |app| | |
| if (script = Property::Script.where(app: app, name: 'msgapp').first) | |
| script.destroy | |
| end | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment