diff --git a/Tools/MediaPortal.DeployTool/ApplicationLocations.xml b/Tools/MediaPortal.DeployTool/ApplicationLocations.xml index c72d46e28e4..070dbd20be9 100644 --- a/Tools/MediaPortal.DeployTool/ApplicationLocations.xml +++ b/Tools/MediaPortal.DeployTool/ApplicationLocations.xml @@ -34,6 +34,26 @@ Manual + + + + https://install.team-mediaportal.com/MySql_8_3 + mysql-8.3.0-winx64.msi + Automatic + + + + https://install.team-mediaportal.com/MariaDB_10 + mariadb-10.11.8-winx64.msi + Automatic + + + + https://install.team-mediaportal.com/DotNetFramework + dotNetFx40_Full_x86_x64.exe + Automatic + + @@ -43,8 +63,6 @@ - - https://install.team-mediaportal.com/VcRedist2015 vcredist2015_x86.exe diff --git a/Tools/MediaPortal.DeployTool/InstallationChecks/MariaDBChecker.cs b/Tools/MediaPortal.DeployTool/InstallationChecks/MariaDBChecker.cs index 8dd8e57ff89..f92f89cd3d9 100644 --- a/Tools/MediaPortal.DeployTool/InstallationChecks/MariaDBChecker.cs +++ b/Tools/MediaPortal.DeployTool/InstallationChecks/MariaDBChecker.cs @@ -330,7 +330,7 @@ public CheckResult CheckStatus() return result; } - RegistryKey key = Utils.LMOpenSubKey("SOFTWARE\\MariaDB 10.0 (x64)"); + RegistryKey key = Utils.LMOpenSubKey("SOFTWARE\\MariaDB 10.11 (x64)"); if (key == null) { result.state = CheckState.NOT_INSTALLED; diff --git a/Tools/MediaPortal.DeployTool/InstallationChecks/MySQLCheckerOutdated.cs b/Tools/MediaPortal.DeployTool/InstallationChecks/MySQLCheckerOutdated.cs new file mode 100644 index 00000000000..3dab05a9ed0 --- /dev/null +++ b/Tools/MediaPortal.DeployTool/InstallationChecks/MySQLCheckerOutdated.cs @@ -0,0 +1,469 @@ +#region Copyright (C) 2005-2024 Team MediaPortal + +// Copyright (C) 2005-2024 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 2 of the License, or +// (at your option) any later version. +// +// MediaPortal is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with MediaPortal. If not, see . + +#endregion + +using System; +using Microsoft.Win32; +using System.IO; +using System.Diagnostics; +using System.Windows.Forms; +using System.Runtime.InteropServices; +using System.ServiceProcess; + +namespace MediaPortal.DeployTool.InstallationChecks +{ + internal class MySQLCheckerOutdated : IInstallationPackage + { + [DllImport("kernel32")] + private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); + + private static readonly string _arch = Utils.Is64bitOS ? "64" : "32"; + private static readonly string prg = "MySQL56" + _arch; + private static readonly string _fileName = Application.StartupPath + "\\deploy\\" + Utils.GetDownloadString(prg, "FILE"); + + private readonly string _dataDir = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + + "\\MySQL\\MySQL Server 5.6"; + + private static bool MySQL51 = false; + private static string strMySQL = ""; + private static string strMySQLData = ""; + + private void PrepareMyIni(string iniFile) + { + WritePrivateProfileString("client", "port", "3306", iniFile); + WritePrivateProfileString("mysql", "default-character-set", "utf8", iniFile); + WritePrivateProfileString("mysqld", "port", "3306", iniFile); + WritePrivateProfileString("mysqld", "basedir", + "\"" + InstallationProperties.Instance["DBMSDir"].Replace('\\', '/') + "/\"", iniFile); + WritePrivateProfileString("mysqld", "datadir", "\"" + _dataDir.Replace('\\', '/') + "/Data\"", iniFile); + WritePrivateProfileString("mysqld", "default-storage-engine", "INNODB", iniFile); + WritePrivateProfileString("mysqld", "sql-mode", + "\"STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION\"", iniFile); + WritePrivateProfileString("mysqld", "max_connections", "100", iniFile); + WritePrivateProfileString("mysqld", "query_cache_size", "32M", iniFile); + WritePrivateProfileString("mysqld", "tmp_table_size", "18M", iniFile); + WritePrivateProfileString("mysqld", "thread_cache_size", "4", iniFile); + WritePrivateProfileString("mysqld", "thread_concurrency", "4", iniFile); + WritePrivateProfileString("mysqld", "myisam_max_sort_file_size", "100M", iniFile); + WritePrivateProfileString("mysqld", "myisam_sort_buffer_size", "64M", iniFile); + WritePrivateProfileString("mysqld", "key_buffer_size", "16M", iniFile); + WritePrivateProfileString("mysqld", "read_buffer_size", "2M", iniFile); + WritePrivateProfileString("mysqld", "read_rnd_buffer_size", "16M", iniFile); + WritePrivateProfileString("mysqld", "sort_buffer_size", "2M", iniFile); + WritePrivateProfileString("mysqld", "innodb_additional_mem_pool_size", "2M", iniFile); + WritePrivateProfileString("mysqld", "innodb_flush_log_at_trx_commit", "1", iniFile); + WritePrivateProfileString("mysqld", "innodb_log_buffer_size", "1M", iniFile); + WritePrivateProfileString("mysqld", "innodb_buffer_pool_size", "96M", iniFile); + WritePrivateProfileString("mysqld", "innodb_log_file_size", "50M", iniFile); + WritePrivateProfileString("mysqld", "innodb_thread_concurrency", "8", iniFile); + } + + public string GetDisplayName() + { + return "MySQL 5.6"; + } + + public string GetIconName() + { + return "MySQL"; + } + + public bool Download() + { + DialogResult result = Utils.RetryDownloadFile(_fileName, prg); + return (result == DialogResult.OK); + } + + private bool IsMySQL51Installed() + { + RegistryKey key = Utils.LMOpenSubKey("SOFTWARE\\MySQL AB\\MySQL Server 5.1"); + if (key != null) + { + strMySQL = key.GetValue("Location").ToString(); + if (Utils.CheckTargetDir(strMySQL) && strMySQL.Contains("MySQL Server 5.1")) + { + strMySQLData = key.GetValue("DataLocation").ToString(); + key.Close(); + return true; + } + } + return false; + } + + public bool BackupDB() + { + if (!string.IsNullOrEmpty(strMySQL) && !string.IsNullOrEmpty(strMySQLData)) + { + const string ServiceName = "MySQL5"; + ServiceController ctrl = new ServiceController(ServiceName); + // Check if MySQL is running and try to start it if not + if (!ctrl.Status.Equals(ServiceControllerStatus.Running)) + { + try + { + ctrl.Start(); + } + catch (Exception) + { + MessageBox.Show("MySQL - start backup DB service exception"); + return false; + } + } + + ctrl.WaitForStatus(ServiceControllerStatus.Running); + // Service is running, but on slow machines still take some time to answer network queries + System.Threading.Thread.Sleep(5000); + + string strMySqlDump = null; + strMySqlDump = "\"" + strMySQL + "bin\\mysqldump.exe" + "\""; + string cmdLine = "-uroot -p" + InstallationProperties.Instance["DBMSPassword"] + + " --all-databases --flush-logs"; + cmdLine += " -r " + "\"" + Path.GetTempPath() + "all_databases.sql" + "\""; + Process setup = Process.Start(strMySqlDump, cmdLine); + try + { + if (setup != null) + { + setup.WaitForExit(); + } + } + catch + { + return false; + } + + // Try to stop MySQL service + try + { + ctrl.Stop(); + } + catch (Exception) + { + MessageBox.Show("MySQL - stop backup DB service exception"); + //return false; + } + + string cmdExe = Environment.SystemDirectory + "\\sc.exe"; + string cmdParam = "delete " + ServiceName; // +"\""; +#if DEBUG + string ff = "c:\\mysql-srv-delete.bat"; + StreamWriter a = new StreamWriter(ff); + a.WriteLine("@echo off"); + a.WriteLine(cmdExe + " " + cmdParam); + a.Close(); + Process svcInstaller = Process.Start(ff); +#else + Process svcInstaller = Process.Start(cmdExe, cmdParam); +#endif + if (svcInstaller != null) + { + svcInstaller.WaitForExit(); + } + return true; + } + return false; + } + + public bool RestoreDB() + { + string strMySql = InstallationProperties.Instance["DBMSDir"] + "\\bin\\mysql.exe"; + string cmdLine = "--host=localhost --user=root --port=3306 --default-character-set=utf8 -p"; + cmdLine += InstallationProperties.Instance["DBMSPassword"]; + cmdLine += " --comments "; + cmdLine += "-e " + "\"" + "source " + Path.GetTempPath() + "all_databases.sql" + "\""; + Process setup = Process.Start(strMySql, cmdLine); + try + { + if (setup != null) + { + setup.WaitForExit(); + } + } + catch + { + return false; + } + return true; + } + + public bool ForceUpdateDB() + { + string strMySql = InstallationProperties.Instance["DBMSDir"] + "\\bin\\mysql_upgrade.exe"; + string cmdLine = "--host=localhost --user=root -p"; + cmdLine += InstallationProperties.Instance["DBMSPassword"]; + cmdLine += " --force"; + Process setup = Process.Start(strMySql, cmdLine); + try + { + if (setup != null) + { + setup.WaitForExit(); + } + } + catch + { + return false; + } + return true; + } + + public bool Install() + { + MySQL51 = IsMySQL51Installed(); + bool IsBackupDB = false; + if (MySQL51) + { + // Backup MySQL 5.1 Database and uninstall current MySQL 5.1 + IsBackupDB = BackupDB(); + Utils.UninstallMSI("{561AB451-B967-475C-80E0-3B6679C38B52}"); + Utils.UninstallMSI("{291D8FE1-ED05-4934-80CE-A5F6B7A8718D}"); + } + + if (!IsBackupDB) + { + // Try to stop actual MySQL Service + const string OldServiceName = "MySQL5"; + ServiceController ctrlMySQL = new ServiceController(OldServiceName); + try + { + ctrlMySQL.Stop(); + } + catch (Exception) + { + // Catch if service can't be stopped or didn't exist + } + } + + string cmdLine = "/i \"" + _fileName + "\""; + cmdLine += " INSTALLDIR=\"" + InstallationProperties.Instance["DBMSDir"] + "\""; + cmdLine += " DATADIR=\"" + _dataDir + "\""; + cmdLine += " /qn"; + cmdLine += " /L* \"" + Path.GetTempPath() + "\\mysqlinst.log\""; + Process setup = Process.Start("msiexec.exe", cmdLine); + try + { + if (setup != null) + { + setup.WaitForExit(); + } + } + catch + { + return false; + } + StreamReader sr = new StreamReader(Path.GetTempPath() + "\\mysqlinst.log"); + bool installOk = false; + while (!sr.EndOfStream) + { + string line = sr.ReadLine(); + if (line.Contains("Configuration completed successfully") || line.Contains("Installation completed successfully") || line.Contains("completed successfully")) + { + installOk = true; + //File.Delete(Path.GetTempPath() + "\\mysqlinst.log"); + break; + } + } + sr.Close(); + if (!installOk) + { + return false; + } + string inifile = InstallationProperties.Instance["DBMSDir"] + "\\my.ini"; + PrepareMyIni(inifile); + const string ServiceName = "MySQL5"; + string cmdExe = Environment.SystemDirectory + "\\sc.exe"; + string cmdParam = "create " + ServiceName + " start= auto DisplayName= " + ServiceName + " binPath= \"" + + InstallationProperties.Instance["DBMSDir"] + "\\bin\\mysqld.exe --defaults-file=\\\"" + inifile + + "\\\" " + ServiceName + "\""; +#if DEBUG + string ff = "c:\\mysql-srv.bat"; + StreamWriter a = new StreamWriter(ff); + a.WriteLine("@echo off"); + a.WriteLine(cmdExe + " " + cmdParam); + a.Close(); + Process svcInstaller = Process.Start(ff); +#else + Process svcInstaller = Process.Start(cmdExe, cmdParam); +#endif + + if (svcInstaller != null) + { + svcInstaller.WaitForExit(); + } + + ServiceController ctrl = new ServiceController(ServiceName); + try + { + ctrl.Start(); + } + catch (Exception) + { + MessageBox.Show("MySQL - start service exception"); + return false; + } + + ctrl.WaitForStatus(ServiceControllerStatus.Running); + // Service is running, but on slow machines still take some time to answer network queries + System.Threading.Thread.Sleep(5000); + // + // mysqladmin.exe is used to set MySQL password + // + cmdLine = "-u root password " + InstallationProperties.Instance["DBMSPassword"]; + + try + { + // Try restore DB here first + if (MySQL51) + { + RestoreDB(); + ForceUpdateDB(); + } + + Process mysqladmin = Process.Start(InstallationProperties.Instance["DBMSDir"] + "\\bin\\mysqladmin.exe", cmdLine); + if (mysqladmin != null) + { + mysqladmin.WaitForExit(); + if (mysqladmin.ExitCode != 0) + { + cmdLine = "-u root --password=" + InstallationProperties.Instance["DBMSPassword"] + " password " + InstallationProperties.Instance["DBMSPassword"]; + mysqladmin = Process.Start(InstallationProperties.Instance["DBMSDir"] + "\\bin\\mysqladmin.exe", cmdLine); + if (mysqladmin != null) + { + mysqladmin.WaitForExit(); + if (mysqladmin.ExitCode != 0) + { + MessageBox.Show("MySQL - set password error: " + mysqladmin.ExitCode); + return false; + } + } + } + } + } + catch (Exception) + { + MessageBox.Show("MySQL - set password exception"); + return false; + } + System.Threading.Thread.Sleep(2000); + // + // mysql.exe is used to grant root access from all machines + // + cmdLine = "-u root --password=" + InstallationProperties.Instance["DBMSPassword"] + + " --execute=\"GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '" + + InstallationProperties.Instance["DBMSPassword"] + "' WITH GRANT OPTION\" mysql"; + Process mysql = Process.Start(InstallationProperties.Instance["DBMSDir"] + "\\bin\\mysql.exe", cmdLine); + try + { + if (mysql != null) + { + mysql.WaitForExit(); + if (mysql.ExitCode != 0) + { + MessageBox.Show("MySQL - set privileges error: " + mysql.ExitCode); + return false; + } + } + } + catch (Exception) + { + MessageBox.Show("MySQL - set privileges exception"); + return false; + } + + if (MySQL51) + { + RestoreDB(); + ForceUpdateDB(); + } + return true; + } + + public bool UnInstall() + { + Utils.UninstallMSI("{56DA0CB5-ABD2-4318-BEAB-62FDBC9B12CC}"); + return true; + } + + public CheckResult CheckStatus() + { + CheckResult result = default(CheckResult); + + // check if the user does not want MySQL installed + if (InstallationProperties.Instance["ConfigureMediaPortalMySQL"] == "No") + { + result.state = CheckState.SKIPPED; + return result; + } + + result.needsDownload = true; + FileInfo mySqlFile = new FileInfo(_fileName); + + if (mySqlFile.Exists && mySqlFile.Length != 0) + { + result.needsDownload = false; + } + + if (InstallationProperties.Instance["InstallType"] == "download_only") + { + result.state = result.needsDownload == false ? CheckState.DOWNLOADED : CheckState.NOT_DOWNLOADED; + return result; + } + + RegistryKey key = Utils.LMOpenSubKey("SOFTWARE\\MySQL AB\\MySQL Server 5.6"); + if (key == null) + { + result.state = CheckState.NOT_INSTALLED; + } + else + { + key.Close(); + result.state = CheckState.INSTALLED; + } + return result; + } + + public static CheckResult CheckStatusMySQL51() + { + CheckResult result; + result.needsDownload = true; + FileInfo mySqlFile = new FileInfo(_fileName); + + if (mySqlFile.Exists && mySqlFile.Length != 0) + result.needsDownload = false; + + if (InstallationProperties.Instance["InstallType"] == "download_only") + { + result.state = result.needsDownload == false ? CheckState.DOWNLOADED : CheckState.NOT_DOWNLOADED; + return result; + } + + RegistryKey key = Utils.LMOpenSubKey("SOFTWARE\\MySQL AB\\MySQL Server 5.1"); + if (key == null) + { + result.state = CheckState.NOT_INSTALLED; + } + else + { + key.Close(); + result.state = CheckState.INSTALLED; + } + return result; + } + } +} \ No newline at end of file diff --git a/Tools/MediaPortal.DeployTool/MediaPortal.DeployTool.csproj b/Tools/MediaPortal.DeployTool/MediaPortal.DeployTool.csproj index 5df29852525..ec7ea0c43b6 100644 --- a/Tools/MediaPortal.DeployTool/MediaPortal.DeployTool.csproj +++ b/Tools/MediaPortal.DeployTool/MediaPortal.DeployTool.csproj @@ -80,7 +80,7 @@ true bin\Debug\ - TRACE;DEBUG;NO_TV_SERVER + TRACE;DEBUG 1 full x64 @@ -161,6 +161,7 @@ + diff --git a/Tools/MediaPortal.DeployTool/MediaPortal.DeployTool.exe.manifest b/Tools/MediaPortal.DeployTool/MediaPortal.DeployTool.exe.manifest index 00f9f6485c4..9f9846c6ab6 100644 --- a/Tools/MediaPortal.DeployTool/MediaPortal.DeployTool.exe.manifest +++ b/Tools/MediaPortal.DeployTool/MediaPortal.DeployTool.exe.manifest @@ -1,7 +1,21 @@ MediaPortal Deploy Tool - + + + + + + + + + + + + + + + MySQL 8 + + MySQL 5.6 + MariaDB 10 diff --git a/Tools/MediaPortal.DeployTool/Sections/BaseInstallationTypeDlg.cs b/Tools/MediaPortal.DeployTool/Sections/BaseInstallationTypeDlg.cs index 38d3b09ea78..e7d094dccba 100644 --- a/Tools/MediaPortal.DeployTool/Sections/BaseInstallationTypeDlg.cs +++ b/Tools/MediaPortal.DeployTool/Sections/BaseInstallationTypeDlg.cs @@ -100,8 +100,16 @@ public override void SetProperties() } else { - InstallationProperties.Instance.Set("DBMSType", "MariaDB"); - InstallationProperties.Instance.Set("DBMSDir", InstallationProperties.Instance["ProgramFiles"] + "\\MariaDB\\MariaDB 10.0"); + if (OSInfo.OSInfo.Win10OrLater() && Utils.Is64bitOS) + { + InstallationProperties.Instance.Set("DBMSType", "MariaDB"); + InstallationProperties.Instance.Set("DBMSDir", InstallationProperties.Instance["ProgramFiles"] + "\\MariaDB\\MariaDB 10.0"); + } + else + { + InstallationProperties.Instance.Set("DBMSType", "MySQL"); + InstallationProperties.Instance.Set("DBMSDir", InstallationProperties.Instance["ProgramFiles"] + "\\MySQL\\MySQL Server 5.6"); + } } } } diff --git a/Tools/MediaPortal.DeployTool/Sections/DBMSSettingsDlg.cs b/Tools/MediaPortal.DeployTool/Sections/DBMSSettingsDlg.cs index 623c64852e5..cf9f0be46ff 100644 --- a/Tools/MediaPortal.DeployTool/Sections/DBMSSettingsDlg.cs +++ b/Tools/MediaPortal.DeployTool/Sections/DBMSSettingsDlg.cs @@ -30,11 +30,24 @@ public DBMSSettingsDlg() InitializeComponent(); type = DialogType.DBMSSettings; if (InstallationProperties.Instance["DBMSType"] == "MSSQL") + { textBoxDir.Text = installationPath = InstallationProperties.Instance["ProgramFiles"] + "\\Microsoft SQL Server"; + } if (InstallationProperties.Instance["DBMSType"] == "MariaDB") + { textBoxDir.Text = installationPath = InstallationProperties.Instance["ProgramFiles"] + "\\MariaDB\\MariaDB 10.0"; + } else - textBoxDir.Text = installationPath = InstallationProperties.Instance["ProgramFiles"] + "\\MySQL\\MySQL Server 8.3"; + { + if (OSInfo.OSInfo.Win10OrLater() && Utils.Is64bitOS) + { + textBoxDir.Text = installationPath = InstallationProperties.Instance["ProgramFiles"] + "\\MySQL\\MySQL Server 8.3"; + } + else + { + textBoxDir.Text = installationPath = InstallationProperties.Instance["ProgramFiles"] + "\\MySQL\\MySQL Server 5.6"; + } + } UpdateUI(); } diff --git a/Tools/MediaPortal.DeployTool/Sections/DBMSTypeDlg.cs b/Tools/MediaPortal.DeployTool/Sections/DBMSTypeDlg.cs index 66e9a8dd4c2..29826e0b836 100644 --- a/Tools/MediaPortal.DeployTool/Sections/DBMSTypeDlg.cs +++ b/Tools/MediaPortal.DeployTool/Sections/DBMSTypeDlg.cs @@ -61,6 +61,15 @@ public override void UpdateUI() lbMSSQL.Enabled = true; lbMSSQL.Text = Localizer.GetBestTranslation("DBMSType_lbMSSQL_disabled"); } + if ( !(OSInfo.OSInfo.Win10OrLater() && Utils.Is64bitOS) ) + { + bMariaDB.Enabled = false; + rbMariaDB.Click -= bMariaDB_Click; + rbMariaDB.Cursor = DefaultCursor; + rbMariaDB.ForeColor = Color.DimGray; + + rbMySQL.Text = Localizer.GetBestTranslation("DBMSType_rbMySQLOutdated"); + } } public override DeployDialog GetNextDialog() diff --git a/Tools/MediaPortal.DeployTool/Sections/InstallDlg.cs b/Tools/MediaPortal.DeployTool/Sections/InstallDlg.cs index c6c185dd3d7..09d8eac818d 100644 --- a/Tools/MediaPortal.DeployTool/Sections/InstallDlg.cs +++ b/Tools/MediaPortal.DeployTool/Sections/InstallDlg.cs @@ -221,7 +221,14 @@ private void PopulateListView() } if (InstallationProperties.Instance["DBMSType"] == "MySQL") { - AddPackageToListView(new MySQLChecker()); + if (OSInfo.OSInfo.Win10OrLater() && Utils.Is64bitOS) + { + AddPackageToListView(new MySQLChecker()); + } + else + { + AddPackageToListView(new MySQLCheckerOutdated()); + } } if (InstallationProperties.Instance["DBMSType"] == "MariaDB") { @@ -243,7 +250,14 @@ private void PopulateListView() } if (InstallationProperties.Instance["DBMSType"] == "MySQL") { - AddPackageToListView(new MySQLChecker()); + if (OSInfo.OSInfo.Win10OrLater() && Utils.Is64bitOS) + { + AddPackageToListView(new MySQLChecker()); + } + else + { + AddPackageToListView(new MySQLCheckerOutdated()); + } } if (InstallationProperties.Instance["DBMSType"] == "MariaDB") { @@ -270,7 +284,14 @@ private void PopulateListView() AddPackageToListView(new MediaPortalChecker()); // framug: MS SQL is no longer supported // AddPackageToListView(new MSSQLExpressChecker()); - AddPackageToListView(new MySQLChecker()); + if (OSInfo.OSInfo.Win10OrLater() && Utils.Is64bitOS) + { + AddPackageToListView(new MySQLChecker()); + } + else + { + AddPackageToListView(new MySQLCheckerOutdated()); + } #if NO_TV_SERVER #else diff --git a/TvEngine3/TVLibrary/SetupTv/Properties/AssemblyInfo.cs b/TvEngine3/TVLibrary/SetupTv/Properties/AssemblyInfo.cs index fd2ada84378..d939821d783 100644 --- a/TvEngine3/TVLibrary/SetupTv/Properties/AssemblyInfo.cs +++ b/TvEngine3/TVLibrary/SetupTv/Properties/AssemblyInfo.cs @@ -1,6 +1,6 @@ -#region Copyright (C) 2005-2011 Team MediaPortal +#region Copyright (C) 2005-2024 Team MediaPortal -// Copyright (C) 2005-2011 Team MediaPortal +// Copyright (C) 2005-2024 Team MediaPortal // http://www.team-mediaportal.com // // MediaPortal is free software: you can redistribute it and/or modify diff --git a/TvEngine3/TVLibrary/SetupTv/39_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/39_upgrade_mysql_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/39_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/39_upgrade_mysql_database.sql index 83e6236633a..7657a73b111 100644 --- a/TvEngine3/TVLibrary/SetupTv/39_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/39_upgrade_mysql_database.sql @@ -1,6 +1,6 @@ -USE %TvLibrary%; - -ALTER TABLE "Card" - ADD COLUMN "preload" bit(1) NOT NULL; - -UPDATE "Version" SET "versionNumber"=39; +USE %TvLibrary%; + +ALTER TABLE "Card" + ADD COLUMN "preload" bit(1) NOT NULL; + +UPDATE "Version" SET "versionNumber"=39; diff --git a/TvEngine3/TVLibrary/SetupTv/39_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/39_upgrade_sqlserver_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/39_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/39_upgrade_sqlserver_database.sql index 6b28c2c981a..32b6e253be8 100644 --- a/TvEngine3/TVLibrary/SetupTv/39_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/39_upgrade_sqlserver_database.sql @@ -1,9 +1,9 @@ -use %TvLibrary% -GO - -ALTER TABLE Card - ADD preload bit NOT NULL CONSTRAINT DF_Card_preload DEFAULT ((0)) -GO - -UPDATE Version SET versionNumber=39 -GO +use %TvLibrary% +GO + +ALTER TABLE Card + ADD preload bit NOT NULL CONSTRAINT DF_Card_preload DEFAULT ((0)) +GO + +UPDATE Version SET versionNumber=39 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/40_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/40_upgrade_mysql_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/40_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/40_upgrade_mysql_database.sql index ca4560afdc0..fe6aa77c8a5 100644 --- a/TvEngine3/TVLibrary/SetupTv/40_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/40_upgrade_mysql_database.sql @@ -1,6 +1,6 @@ -USE %TvLibrary%; - -ALTER TABLE "Card" - ADD COLUMN "CAM" bit(1) NOT NULL; - -UPDATE "Version" SET "versionNumber"=40; +USE %TvLibrary%; + +ALTER TABLE "Card" + ADD COLUMN "CAM" bit(1) NOT NULL; + +UPDATE "Version" SET "versionNumber"=40; diff --git a/TvEngine3/TVLibrary/SetupTv/40_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/40_upgrade_sqlserver_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/40_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/40_upgrade_sqlserver_database.sql index 3b2a61289fe..8d2ea87aab5 100644 --- a/TvEngine3/TVLibrary/SetupTv/40_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/40_upgrade_sqlserver_database.sql @@ -1,9 +1,9 @@ -use %TvLibrary% -GO - -ALTER TABLE Card - ADD CAM bit NOT NULL CONSTRAINT DF_Card_CAM DEFAULT ((0)) -GO - -UPDATE Version SET versionNumber=40 -GO +use %TvLibrary% +GO + +ALTER TABLE Card + ADD CAM bit NOT NULL CONSTRAINT DF_Card_CAM DEFAULT ((0)) +GO + +UPDATE Version SET versionNumber=40 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/41_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/41_upgrade_mysql_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/41_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/41_upgrade_mysql_database.sql index a9b0acdef45..47bc9ce48ad 100644 --- a/TvEngine3/TVLibrary/SetupTv/41_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/41_upgrade_mysql_database.sql @@ -1,6 +1,6 @@ -USE %TvLibrary%; - -ALTER TABLE "TuningDetail" - ADD COLUMN "audioSource" int(1) NOT NULL; - -UPDATE "Version" SET "versionNumber"=41; +USE %TvLibrary%; + +ALTER TABLE "TuningDetail" + ADD COLUMN "audioSource" int(1) NOT NULL; + +UPDATE "Version" SET "versionNumber"=41; diff --git a/TvEngine3/TVLibrary/SetupTv/41_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/41_upgrade_sqlserver_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/41_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/41_upgrade_sqlserver_database.sql index 5e7e9334e76..a12488a7b89 100644 --- a/TvEngine3/TVLibrary/SetupTv/41_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/41_upgrade_sqlserver_database.sql @@ -1,9 +1,9 @@ -use %TvLibrary% -GO - -ALTER TABLE TuningDetail - ADD audioSource int NOT NULL CONSTRAINT DF_TuningDetail_audioSource DEFAULT ((1)) -GO - -UPDATE Version SET versionNumber=41 -GO +use %TvLibrary% +GO + +ALTER TABLE TuningDetail + ADD audioSource int NOT NULL CONSTRAINT DF_TuningDetail_audioSource DEFAULT ((1)) +GO + +UPDATE Version SET versionNumber=41 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/42_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/42_upgrade_mysql_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/42_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/42_upgrade_mysql_database.sql index c36087277ec..e0039471c96 100644 --- a/TvEngine3/TVLibrary/SetupTv/42_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/42_upgrade_mysql_database.sql @@ -1,6 +1,6 @@ -USE %TvLibrary%; - -ALTER TABLE "TuningDetail" - ADD COLUMN "isVCRSignal" bit(1) NOT NULL; - -UPDATE "Version" SET "versionNumber"=42; +USE %TvLibrary%; + +ALTER TABLE "TuningDetail" + ADD COLUMN "isVCRSignal" bit(1) NOT NULL; + +UPDATE "Version" SET "versionNumber"=42; diff --git a/TvEngine3/TVLibrary/SetupTv/42_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/42_upgrade_sqlserver_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/42_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/42_upgrade_sqlserver_database.sql index 84868a14096..9be0506fac6 100644 --- a/TvEngine3/TVLibrary/SetupTv/42_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/42_upgrade_sqlserver_database.sql @@ -1,9 +1,9 @@ -use %TvLibrary% -GO - -ALTER TABLE TuningDetail - ADD isVCRSignal bit NOT NULL CONSTRAINT DF_TuningDetail_isVCRSignal DEFAULT ((0)) -GO - -UPDATE Version SET versionNumber=42 -GO +use %TvLibrary% +GO + +ALTER TABLE TuningDetail + ADD isVCRSignal bit NOT NULL CONSTRAINT DF_TuningDetail_isVCRSignal DEFAULT ((0)) +GO + +UPDATE Version SET versionNumber=42 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/43_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/43_upgrade_mysql_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/43_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/43_upgrade_mysql_database.sql index e4ef5838acb..fc26e6af5e8 100644 --- a/TvEngine3/TVLibrary/SetupTv/43_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/43_upgrade_mysql_database.sql @@ -1,6 +1,6 @@ -USE %TvLibrary%; - -ALTER TABLE "Schedule" - ADD COLUMN "series" bit(1) NOT NULL; - +USE %TvLibrary%; + +ALTER TABLE "Schedule" + ADD COLUMN "series" bit(1) NOT NULL; + UPDATE "Version" SET "versionNumber"=43; \ No newline at end of file diff --git a/TvEngine3/TVLibrary/SetupTv/43_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/43_upgrade_sqlserver_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/43_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/43_upgrade_sqlserver_database.sql index 58e92d1e882..7ceb2b4c081 100644 --- a/TvEngine3/TVLibrary/SetupTv/43_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/43_upgrade_sqlserver_database.sql @@ -1,9 +1,9 @@ -use %TvLibrary% -GO - -ALTER TABLE Schedule - ADD series bit NOT NULL CONSTRAINT DF_Schedule_series DEFAULT ((0)) -GO - -UPDATE Version SET versionNumber=43 -GO +use %TvLibrary% +GO + +ALTER TABLE Schedule + ADD series bit NOT NULL CONSTRAINT DF_Schedule_series DEFAULT ((0)) +GO + +UPDATE Version SET versionNumber=43 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/44_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/44_upgrade_mysql_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/44_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/44_upgrade_mysql_database.sql index 4c815ba520c..143b7154738 100644 --- a/TvEngine3/TVLibrary/SetupTv/44_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/44_upgrade_mysql_database.sql @@ -1,7 +1,7 @@ -USE %TvLibrary%; - -ALTER TABLE "Program" - ADD COLUMN "episodeName" text NOT NULL, - ADD COLUMN "episodePart" text NOT NULL; - +USE %TvLibrary%; + +ALTER TABLE "Program" + ADD COLUMN "episodeName" text NOT NULL, + ADD COLUMN "episodePart" text NOT NULL; + UPDATE "Version" SET "versionNumber"=44; \ No newline at end of file diff --git a/TvEngine3/TVLibrary/SetupTv/44_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/44_upgrade_sqlserver_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/44_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/44_upgrade_sqlserver_database.sql index 8fa6dac57bd..38256997615 100644 --- a/TvEngine3/TVLibrary/SetupTv/44_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/44_upgrade_sqlserver_database.sql @@ -1,10 +1,10 @@ -use %TvLibrary% -GO - -ALTER TABLE Program - ADD episodeName varchar(MAX) NOT NULL CONSTRAINT [DF_Program_EpisodeName] DEFAULT '', - episodePart varchar(MAX) NOT NULL CONSTRAINT [DF_Program_EpisodePart] DEFAULT '' -GO - -UPDATE Version SET versionNumber=44 -GO +use %TvLibrary% +GO + +ALTER TABLE Program + ADD episodeName varchar(MAX) NOT NULL CONSTRAINT [DF_Program_EpisodeName] DEFAULT '', + episodePart varchar(MAX) NOT NULL CONSTRAINT [DF_Program_EpisodePart] DEFAULT '' +GO + +UPDATE Version SET versionNumber=44 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/45_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/45_upgrade_mysql_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/45_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/45_upgrade_mysql_database.sql index 3f3973254b4..a813ecc6de0 100644 --- a/TvEngine3/TVLibrary/SetupTv/45_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/45_upgrade_mysql_database.sql @@ -1,10 +1,10 @@ -USE %TvLibrary%; - -ALTER TABLE "Recording" - MODIFY COLUMN "fileName" VARCHAR(255) NOT NULL, - ADD INDEX "IDX_Recording_Filename"("fileName"); - -ALTER TABLE "Program" - ADD INDEX "IDX_Program_Notify"("notify"); - +USE %TvLibrary%; + +ALTER TABLE "Recording" + MODIFY COLUMN "fileName" VARCHAR(255) NOT NULL, + ADD INDEX "IDX_Recording_Filename"("fileName"); + +ALTER TABLE "Program" + ADD INDEX "IDX_Program_Notify"("notify"); + UPDATE "Version" SET "versionNumber"=45; \ No newline at end of file diff --git a/TvEngine3/TVLibrary/SetupTv/45_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/45_upgrade_sqlserver_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/45_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/45_upgrade_sqlserver_database.sql index 78b2e9b1d22..91dcafe8dd1 100644 --- a/TvEngine3/TVLibrary/SetupTv/45_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/45_upgrade_sqlserver_database.sql @@ -1,14 +1,14 @@ -use %TvLibrary% -GO - -ALTER TABLE Recording - ALTER COLUMN fileName VARCHAR(260) NOT NULL -GO - -CREATE INDEX IDX_Recording_Filename ON Recording(fileName) -GO -CREATE INDEX IDX_Program_Notify ON Program(notify) -GO - -UPDATE Version SET versionNumber=45 -GO +use %TvLibrary% +GO + +ALTER TABLE Recording + ALTER COLUMN fileName VARCHAR(260) NOT NULL +GO + +CREATE INDEX IDX_Recording_Filename ON Recording(fileName) +GO +CREATE INDEX IDX_Program_Notify ON Program(notify) +GO + +UPDATE Version SET versionNumber=45 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/46_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/46_upgrade_mysql_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/46_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/46_upgrade_mysql_database.sql index a3f46c97df0..2ebc1588635 100644 --- a/TvEngine3/TVLibrary/SetupTv/46_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/46_upgrade_mysql_database.sql @@ -1,6 +1,6 @@ -USE %TvLibrary%; - -ALTER TABLE "Recording" - ADD COLUMN "episodeName" text NOT NULL; - +USE %TvLibrary%; + +ALTER TABLE "Recording" + ADD COLUMN "episodeName" text NOT NULL; + UPDATE "Version" SET "versionNumber"=46; \ No newline at end of file diff --git a/TvEngine3/TVLibrary/SetupTv/46_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/46_upgrade_sqlserver_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/46_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/46_upgrade_sqlserver_database.sql index ac23a9feb10..1ddcf95ec90 100644 --- a/TvEngine3/TVLibrary/SetupTv/46_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/46_upgrade_sqlserver_database.sql @@ -1,8 +1,8 @@ -use %TvLibrary% -GO - -ALTER TABLE Recording - ADD episodeName varchar(MAX) NOT NULL CONSTRAINT [DF_Recording_EpisodeName] DEFAULT '' - -UPDATE Version SET versionNumber=46 -GO +use %TvLibrary% +GO + +ALTER TABLE Recording + ADD episodeName varchar(MAX) NOT NULL CONSTRAINT [DF_Recording_EpisodeName] DEFAULT '' + +UPDATE Version SET versionNumber=46 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/47_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/47_upgrade_mysql_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/47_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/47_upgrade_mysql_database.sql index ce1fc9143dd..e159a3a0022 100644 --- a/TvEngine3/TVLibrary/SetupTv/47_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/47_upgrade_mysql_database.sql @@ -1,8 +1,8 @@ -USE %TvLibrary%; - -ALTER TABLE "Recording" - ADD COLUMN "seriesNum" VARCHAR(200) NOT NULL, - ADD COLUMN "episodeNum" VARCHAR(200) NOT NULL, - ADD COLUMN "episodePart" TEXT NOT NULL; - -UPDATE "Version" SET "versionNumber"=47; +USE %TvLibrary%; + +ALTER TABLE "Recording" + ADD COLUMN "seriesNum" VARCHAR(200) NOT NULL, + ADD COLUMN "episodeNum" VARCHAR(200) NOT NULL, + ADD COLUMN "episodePart" TEXT NOT NULL; + +UPDATE "Version" SET "versionNumber"=47; diff --git a/TvEngine3/TVLibrary/SetupTv/47_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/47_upgrade_sqlserver_database.sql similarity index 97% rename from TvEngine3/TVLibrary/SetupTv/47_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/47_upgrade_sqlserver_database.sql index a447dfeb5c2..7f5aaf4171c 100644 --- a/TvEngine3/TVLibrary/SetupTv/47_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/47_upgrade_sqlserver_database.sql @@ -1,10 +1,10 @@ -use %TvLibrary% -GO - -ALTER TABLE Recording - ADD seriesNum varchar(200) NOT NULL CONSTRAINT [DF_Recording_SeriesNum] DEFAULT '', - episodeNum varchar(200) NOT NULL CONSTRAINT [DF_Recording_EpisodeNum] DEFAULT '', - episodePart varchar(MAX) NOT NULL CONSTRAINT [DF_Recording_EpisodePart] DEFAULT '' - -UPDATE Version SET versionNumber=47 -GO +use %TvLibrary% +GO + +ALTER TABLE Recording + ADD seriesNum varchar(200) NOT NULL CONSTRAINT [DF_Recording_SeriesNum] DEFAULT '', + episodeNum varchar(200) NOT NULL CONSTRAINT [DF_Recording_EpisodeNum] DEFAULT '', + episodePart varchar(MAX) NOT NULL CONSTRAINT [DF_Recording_EpisodePart] DEFAULT '' + +UPDATE Version SET versionNumber=47 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/48_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/48_upgrade_mysql_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/48_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/48_upgrade_mysql_database.sql index cd79c3e8b11..799320da1f0 100644 --- a/TvEngine3/TVLibrary/SetupTv/48_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/48_upgrade_mysql_database.sql @@ -1,6 +1,6 @@ -USE %TvLibrary%; - -ALTER TABLE "Server" - ADD COLUMN "rtspPort" INT NOT NULL DEFAULT 554; - -UPDATE "Version" SET "versionNumber"=48; +USE %TvLibrary%; + +ALTER TABLE "Server" + ADD COLUMN "rtspPort" INT NOT NULL DEFAULT 554; + +UPDATE "Version" SET "versionNumber"=48; diff --git a/TvEngine3/TVLibrary/SetupTv/48_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/48_upgrade_sqlserver_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/48_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/48_upgrade_sqlserver_database.sql index 7ea44490b55..81b115ba6e4 100644 --- a/TvEngine3/TVLibrary/SetupTv/48_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/48_upgrade_sqlserver_database.sql @@ -1,8 +1,8 @@ -use %TvLibrary% -GO - -ALTER TABLE Server - ADD rtspPort int NOT NULL CONSTRAINT [DF_Server_RtspPort] DEFAULT 554 - -UPDATE Version SET versionNumber=48 -GO +use %TvLibrary% +GO + +ALTER TABLE Server + ADD rtspPort int NOT NULL CONSTRAINT [DF_Server_RtspPort] DEFAULT 554 + +UPDATE Version SET versionNumber=48 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/49_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/49_upgrade_mysql_database.sql similarity index 97% rename from TvEngine3/TVLibrary/SetupTv/49_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/49_upgrade_mysql_database.sql index 1366d489d41..99def37d097 100644 --- a/TvEngine3/TVLibrary/SetupTv/49_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/49_upgrade_mysql_database.sql @@ -1,13 +1,13 @@ -USE %TvLibrary%; - -ALTER TABLE "Recording" ADD COLUMN "isRecording" BIT NOT NULL DEFAULT 0; -ALTER TABLE "Recording" ADD COLUMN "idSchedule" INT NOT NULL DEFAULT 0; - -ALTER TABLE "Program" ADD COLUMN "state" INT NOT NULL DEFAULT 0; -UPDATE "Program" SET state=1 WHERE notify=1; -ALTER TABLE "Program" DROP COLUMN "notify"; -ALTER TABLE "Program" ADD INDEX IDX_Program_State(state); - -ALTER TABLE "Schedule" ADD COLUMN "idParentSchedule" INT NOT NULL DEFAULT 0; - -UPDATE Version SET versionNumber=49; +USE %TvLibrary%; + +ALTER TABLE "Recording" ADD COLUMN "isRecording" BIT NOT NULL DEFAULT 0; +ALTER TABLE "Recording" ADD COLUMN "idSchedule" INT NOT NULL DEFAULT 0; + +ALTER TABLE "Program" ADD COLUMN "state" INT NOT NULL DEFAULT 0; +UPDATE "Program" SET state=1 WHERE notify=1; +ALTER TABLE "Program" DROP COLUMN "notify"; +ALTER TABLE "Program" ADD INDEX IDX_Program_State(state); + +ALTER TABLE "Schedule" ADD COLUMN "idParentSchedule" INT NOT NULL DEFAULT 0; + +UPDATE Version SET versionNumber=49; diff --git a/TvEngine3/TVLibrary/SetupTv/49_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/49_upgrade_sqlserver_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/49_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/49_upgrade_sqlserver_database.sql index 02f3fcc809b..dab7e835f82 100644 --- a/TvEngine3/TVLibrary/SetupTv/49_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/49_upgrade_sqlserver_database.sql @@ -1,51 +1,51 @@ -use %TvLibrary% -GO - -ALTER TABLE Recording - ADD isRecording BIT NOT NULL CONSTRAINT [DF_Recording_isRecording] DEFAULT 0, - idSchedule INT NOT NULL CONSTRAINT [DF_Recording_idSchedule] DEFAULT 0 -GO - -DROP INDEX IDX_Program_Notify ON Program -DROP INDEX IX_Program_EPG_Lookup ON Program -GO - -ALTER TABLE Program - ADD state INT NOT NULL CONSTRAINT [DF_Program_state] DEFAULT 0 -GO - -UPDATE Program SET state=1 WHERE notify=1 -GO - -ALTER TABLE Program - DROP COLUMN notify -GO - -ALTER TABLE Schedule - ADD idParentSchedule int NOT NULL CONSTRAINT [DF_Schedule_idParentSchedule] DEFAULT 0 -GO - -CREATE UNIQUE INDEX IX_Program_EPG_Lookup ON Program -( - idChannel ASC, - startTime ASC, - endTime ASC -) -INCLUDE -( - title, - description, - seriesNum, - episodeNum, - genre, - originalAirDate, - classification, - starRating, - state, - parentalRating -) -CREATE INDEX IDX_Program_State ON Program(state) -GO - -UPDATE Version SET versionNumber=49 -GO +use %TvLibrary% +GO + +ALTER TABLE Recording + ADD isRecording BIT NOT NULL CONSTRAINT [DF_Recording_isRecording] DEFAULT 0, + idSchedule INT NOT NULL CONSTRAINT [DF_Recording_idSchedule] DEFAULT 0 +GO + +DROP INDEX IDX_Program_Notify ON Program +DROP INDEX IX_Program_EPG_Lookup ON Program +GO + +ALTER TABLE Program + ADD state INT NOT NULL CONSTRAINT [DF_Program_state] DEFAULT 0 +GO + +UPDATE Program SET state=1 WHERE notify=1 +GO + +ALTER TABLE Program + DROP COLUMN notify +GO + +ALTER TABLE Schedule + ADD idParentSchedule int NOT NULL CONSTRAINT [DF_Schedule_idParentSchedule] DEFAULT 0 +GO + +CREATE UNIQUE INDEX IX_Program_EPG_Lookup ON Program +( + idChannel ASC, + startTime ASC, + endTime ASC +) +INCLUDE +( + title, + description, + seriesNum, + episodeNum, + genre, + originalAirDate, + classification, + starRating, + state, + parentalRating +) +CREATE INDEX IDX_Program_State ON Program(state) +GO + +UPDATE Version SET versionNumber=49 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/50_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/50_upgrade_mysql_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/50_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/50_upgrade_mysql_database.sql index eb7a45fc37f..ed751c7c4ae 100644 --- a/TvEngine3/TVLibrary/SetupTv/50_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/50_upgrade_mysql_database.sql @@ -1,6 +1,6 @@ -USE %TvLibrary%; - -ALTER TABLE "Card" - ADD COLUMN "NetProvider" TINYINT DEFAULT 0 NOT NULL; - -UPDATE Version SET versionNumber=50; +USE %TvLibrary%; + +ALTER TABLE "Card" + ADD COLUMN "NetProvider" TINYINT DEFAULT 0 NOT NULL; + +UPDATE Version SET versionNumber=50; diff --git a/TvEngine3/TVLibrary/SetupTv/50_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/50_upgrade_sqlserver_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/50_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/50_upgrade_sqlserver_database.sql index 6cc04834ec1..ffb28f69531 100644 --- a/TvEngine3/TVLibrary/SetupTv/50_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/50_upgrade_sqlserver_database.sql @@ -1,9 +1,9 @@ -use %TvLibrary% -GO - -ALTER TABLE Card - ADD NetProvider tinyint NOT NULL CONSTRAINT DF_NetProvider DEFAULT ((0)) -GO - -UPDATE Version SET versionNumber=50 -GO +use %TvLibrary% +GO + +ALTER TABLE Card + ADD NetProvider tinyint NOT NULL CONSTRAINT DF_NetProvider DEFAULT ((0)) +GO + +UPDATE Version SET versionNumber=50 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/51_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/51_upgrade_mysql_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/51_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/51_upgrade_mysql_database.sql index 1b0cd6afea9..77f128aa4e4 100644 --- a/TvEngine3/TVLibrary/SetupTv/51_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/51_upgrade_mysql_database.sql @@ -1,6 +1,6 @@ -USE %TvLibrary%; - -ALTER TABLE "CanceledSchedule" - ADD COLUMN "idChannel" INT NOT NULL DEFAULT 0; - -UPDATE Version SET versionNumber=51; +USE %TvLibrary%; + +ALTER TABLE "CanceledSchedule" + ADD COLUMN "idChannel" INT NOT NULL DEFAULT 0; + +UPDATE Version SET versionNumber=51; diff --git a/TvEngine3/TVLibrary/SetupTv/51_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/51_upgrade_sqlserver_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/51_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/51_upgrade_sqlserver_database.sql index 0dd1aa0c07f..e44f5c7102c 100644 --- a/TvEngine3/TVLibrary/SetupTv/51_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/51_upgrade_sqlserver_database.sql @@ -1,9 +1,9 @@ -use %TvLibrary% -GO - -ALTER TABLE CanceledSchedule - ADD idChannel int NOT NULL CONSTRAINT DF_IdChannel DEFAULT ((0)) -GO - -UPDATE Version SET versionNumber=51 -GO +use %TvLibrary% +GO + +ALTER TABLE CanceledSchedule + ADD idChannel int NOT NULL CONSTRAINT DF_IdChannel DEFAULT ((0)) +GO + +UPDATE Version SET versionNumber=51 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/52_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/52_upgrade_mysql_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/52_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/52_upgrade_mysql_database.sql index b47bec675e9..1286ef6f454 100644 --- a/TvEngine3/TVLibrary/SetupTv/52_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/52_upgrade_mysql_database.sql @@ -1,7 +1,7 @@ -USE %TvLibrary%; - -DELETE FROM "ChannelLinkageMap"; -ALTER TABLE "ChannelLinkageMap" - ADD COLUMN "displayName" VARCHAR(200) NOT NULL; - -UPDATE Version SET versionNumber=52; +USE %TvLibrary%; + +DELETE FROM "ChannelLinkageMap"; +ALTER TABLE "ChannelLinkageMap" + ADD COLUMN "displayName" VARCHAR(200) NOT NULL; + +UPDATE Version SET versionNumber=52; diff --git a/TvEngine3/TVLibrary/SetupTv/52_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/52_upgrade_sqlserver_database.sql similarity index 93% rename from TvEngine3/TVLibrary/SetupTv/52_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/52_upgrade_sqlserver_database.sql index 5a93b49c1be..9462dc52e8f 100644 --- a/TvEngine3/TVLibrary/SetupTv/52_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/52_upgrade_sqlserver_database.sql @@ -1,11 +1,11 @@ -use %TvLibrary% -GO - -DELETE FROM ChannelLinkageMap -GO -ALTER TABLE ChannelLinkageMap - add displayName varchar(200) NOT NULL -GO - -UPDATE Version SET versionNumber=52 -GO +use %TvLibrary% +GO + +DELETE FROM ChannelLinkageMap +GO +ALTER TABLE ChannelLinkageMap + add displayName varchar(200) NOT NULL +GO + +UPDATE Version SET versionNumber=52 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/53_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/53_upgrade_mysql_database.sql similarity index 98% rename from TvEngine3/TVLibrary/SetupTv/53_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/53_upgrade_mysql_database.sql index 32d38515914..51964606d7f 100644 --- a/TvEngine3/TVLibrary/SetupTv/53_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/53_upgrade_mysql_database.sql @@ -1,38 +1,38 @@ -USE %TvLibrary%; - -CREATE TABLE "SoftwareEncoder" ( - "idEncoder" int(11) NOT NULL auto_increment, - "priority" int(11) NOT NULL, - "name" varchar(200) NOT NULL, - "type" int(11) NOT NULL, - PRIMARY KEY ("idEncoder") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - -/*Data for the table "SoftwareEncoder" */ - -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (1,1,'InterVideo Video Encoder',0); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (2,2,'Ulead MPEG Encoder',0); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (3,3,'MainConcept MPEG Video Encoder',0); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (4,4,'MainConcept Demo MPEG Video Encoder',0); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (5,5,'CyberLink MPEG Video Encoder',0); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (6,6,'CyberLink MPEG Video Encoder(Twinhan)',0); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (7,7,'MainConcept (Hauppauge) MPEG Video Encoder',0); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (8,8,'nanocosmos MPEG Video Encoder',0); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (9,9,'Pinnacle MPEG 2 Encoder',0); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (10,10,'MainConcept (HCW) MPEG-2 Video Encoder',0); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (11,11,'ATI MPEG Video Encoder',0); - -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (12,1,'InterVideo Audio Encoder',1); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (13,2,'Ulead MPEG Audio Encoder',1); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (14,3,'MainConcept MPEG Audio Encoder',1); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (15,4,'MainConcept Demo MPEG Audio Encoder',1); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (16,5,'CyberLink Audio Encoder',1); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (17,6,'CyberLink Audio Encoder(Twinhan)',1); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (18,7,'Pinnacle MPEG Layer-2 Audio Encoder',1); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (19,8,'MainConcept (Hauppauge) MPEG Audio Encoder',1); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (20,9,'NVIDIA Audio Encoder',1); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (21,10,'MainConcept (HCW) Layer II Audio Encoder',1); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (22,11,'CyberLink MPEG Audio Encoder',1); -insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (23,12,'ATI MPEG Audio Encoder',1); - -UPDATE Version SET versionNumber=53; +USE %TvLibrary%; + +CREATE TABLE "SoftwareEncoder" ( + "idEncoder" int(11) NOT NULL auto_increment, + "priority" int(11) NOT NULL, + "name" varchar(200) NOT NULL, + "type" int(11) NOT NULL, + PRIMARY KEY ("idEncoder") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + +/*Data for the table "SoftwareEncoder" */ + +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (1,1,'InterVideo Video Encoder',0); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (2,2,'Ulead MPEG Encoder',0); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (3,3,'MainConcept MPEG Video Encoder',0); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (4,4,'MainConcept Demo MPEG Video Encoder',0); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (5,5,'CyberLink MPEG Video Encoder',0); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (6,6,'CyberLink MPEG Video Encoder(Twinhan)',0); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (7,7,'MainConcept (Hauppauge) MPEG Video Encoder',0); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (8,8,'nanocosmos MPEG Video Encoder',0); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (9,9,'Pinnacle MPEG 2 Encoder',0); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (10,10,'MainConcept (HCW) MPEG-2 Video Encoder',0); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (11,11,'ATI MPEG Video Encoder',0); + +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (12,1,'InterVideo Audio Encoder',1); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (13,2,'Ulead MPEG Audio Encoder',1); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (14,3,'MainConcept MPEG Audio Encoder',1); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (15,4,'MainConcept Demo MPEG Audio Encoder',1); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (16,5,'CyberLink Audio Encoder',1); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (17,6,'CyberLink Audio Encoder(Twinhan)',1); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (18,7,'Pinnacle MPEG Layer-2 Audio Encoder',1); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (19,8,'MainConcept (Hauppauge) MPEG Audio Encoder',1); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (20,9,'NVIDIA Audio Encoder',1); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (21,10,'MainConcept (HCW) Layer II Audio Encoder',1); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (22,11,'CyberLink MPEG Audio Encoder',1); +insert into "SoftwareEncoder"("idEncoder","priority","name","type") values (23,12,'ATI MPEG Audio Encoder',1); + +UPDATE Version SET versionNumber=53; diff --git a/TvEngine3/TVLibrary/SetupTv/53_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/53_upgrade_sqlserver_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/53_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/53_upgrade_sqlserver_database.sql index 191f80e0745..1c42113e7a2 100644 --- a/TvEngine3/TVLibrary/SetupTv/53_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/53_upgrade_sqlserver_database.sql @@ -1,110 +1,110 @@ -use %TvLibrary% -GO - -CREATE TABLE SoftwareEncoder( - idEncoder int IDENTITY(1,1) NOT NULL, - priority int NOT NULL, - name varchar(200) NOT NULL, - type int NOT NULL, - CONSTRAINT PK_SoftwareEncoder PRIMARY KEY -( - idEncoder ASC -) -) - -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (1,'InterVideo Video Encoder',0) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (2,'Ulead MPEG Encoder',0) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (3,'MainConcept MPEG Video Encoder',0) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (4,'MainConcept Demo MPEG Video Encoder',0) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (5,'CyberLink MPEG Video Encoder',0) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (6,'CyberLink MPEG Video Encoder(Twinhan)',0) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (7,'MainConcept (Hauppauge) MPEG Video Encoder',0) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (8,'nanocosmos MPEG Video Encoder',0) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (9,'Pinnacle MPEG 2 Encoder',0) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (10,'MainConcept (HCW) MPEG-2 Video Encoder',0) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (11,'ATI MPEG Video Encoder',0) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (1,'InterVideo Audio Encoder',1) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (2,'Ulead MPEG Audio Encoder',1) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (3,'MainConcept MPEG Audio Encoder',1) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (4,'MainConcept Demo MPEG Audio Encoder',1) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (5,'CyberLink Audio Encoder',1) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (6,'CyberLink Audio Encoder(Twinhan)',1) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (7,'Pinnacle MPEG Layer-2 Audio Encoder',1) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (8,'MainConcept (Hauppauge) MPEG Audio Encoder',1) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (9,'NVIDIA Audio Encoder',1) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (10,'MainConcept (HCW) Layer II Audio Encoder',1) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (11,'CyberLink MPEG Audio Encoder',1) -GO - -INSERT INTO SoftwareEncoder (priority,name,type) - VALUES (12,'ATI MPEG Audio Encoder',1) -GO - -UPDATE Version SET versionNumber=53 -GO +use %TvLibrary% +GO + +CREATE TABLE SoftwareEncoder( + idEncoder int IDENTITY(1,1) NOT NULL, + priority int NOT NULL, + name varchar(200) NOT NULL, + type int NOT NULL, + CONSTRAINT PK_SoftwareEncoder PRIMARY KEY +( + idEncoder ASC +) +) + +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (1,'InterVideo Video Encoder',0) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (2,'Ulead MPEG Encoder',0) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (3,'MainConcept MPEG Video Encoder',0) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (4,'MainConcept Demo MPEG Video Encoder',0) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (5,'CyberLink MPEG Video Encoder',0) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (6,'CyberLink MPEG Video Encoder(Twinhan)',0) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (7,'MainConcept (Hauppauge) MPEG Video Encoder',0) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (8,'nanocosmos MPEG Video Encoder',0) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (9,'Pinnacle MPEG 2 Encoder',0) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (10,'MainConcept (HCW) MPEG-2 Video Encoder',0) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (11,'ATI MPEG Video Encoder',0) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (1,'InterVideo Audio Encoder',1) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (2,'Ulead MPEG Audio Encoder',1) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (3,'MainConcept MPEG Audio Encoder',1) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (4,'MainConcept Demo MPEG Audio Encoder',1) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (5,'CyberLink Audio Encoder',1) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (6,'CyberLink Audio Encoder(Twinhan)',1) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (7,'Pinnacle MPEG Layer-2 Audio Encoder',1) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (8,'MainConcept (Hauppauge) MPEG Audio Encoder',1) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (9,'NVIDIA Audio Encoder',1) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (10,'MainConcept (HCW) Layer II Audio Encoder',1) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (11,'CyberLink MPEG Audio Encoder',1) +GO + +INSERT INTO SoftwareEncoder (priority,name,type) + VALUES (12,'ATI MPEG Audio Encoder',1) +GO + +UPDATE Version SET versionNumber=53 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/54_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/54_upgrade_mysql_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/54_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/54_upgrade_mysql_database.sql index 42421e34910..9c5090bd4fe 100644 --- a/TvEngine3/TVLibrary/SetupTv/54_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/54_upgrade_mysql_database.sql @@ -1,6 +1,6 @@ -USE %TvLibrary%; - -ALTER TABLE "Card" - ADD COLUMN "stopgraph" bit(1) NOT NULL DEFAULT 1; - -UPDATE "Version" SET "versionNumber"=54; +USE %TvLibrary%; + +ALTER TABLE "Card" + ADD COLUMN "stopgraph" bit(1) NOT NULL DEFAULT 1; + +UPDATE "Version" SET "versionNumber"=54; diff --git a/TvEngine3/TVLibrary/SetupTv/54_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/54_upgrade_sqlserver_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/54_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/54_upgrade_sqlserver_database.sql index a7fdb18f165..8dc6c859c79 100644 --- a/TvEngine3/TVLibrary/SetupTv/54_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/54_upgrade_sqlserver_database.sql @@ -1,9 +1,9 @@ -use %TvLibrary% -GO - -ALTER TABLE Card - ADD stopgraph bit NOT NULL CONSTRAINT DF_Card_stopgraph DEFAULT ((1)) -GO - -UPDATE Version SET versionNumber=54 -GO +use %TvLibrary% +GO + +ALTER TABLE Card + ADD stopgraph bit NOT NULL CONSTRAINT DF_Card_stopgraph DEFAULT ((1)) +GO + +UPDATE Version SET versionNumber=54 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/55_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/55_upgrade_mysql_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/55_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/55_upgrade_mysql_database.sql index a1fa50a23e5..645bfcbdbcf 100644 --- a/TvEngine3/TVLibrary/SetupTv/55_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/55_upgrade_mysql_database.sql @@ -1,10 +1,10 @@ -USE %TvLibrary%; - -CREATE TABLE "PendingDeletion" ( - "idPendingDeletion" int(11) NOT NULL auto_increment, - "fileName" varchar(260) NOT NULL, - PRIMARY KEY ("idPendingDeletion") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - - -UPDATE Version SET versionNumber=55; +USE %TvLibrary%; + +CREATE TABLE "PendingDeletion" ( + "idPendingDeletion" int(11) NOT NULL auto_increment, + "fileName" varchar(260) NOT NULL, + PRIMARY KEY ("idPendingDeletion") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; + + +UPDATE Version SET versionNumber=55; diff --git a/TvEngine3/TVLibrary/SetupTv/55_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/55_upgrade_sqlserver_database.sql similarity index 93% rename from TvEngine3/TVLibrary/SetupTv/55_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/55_upgrade_sqlserver_database.sql index 0ce128122ee..98e631bfa2e 100644 --- a/TvEngine3/TVLibrary/SetupTv/55_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/55_upgrade_sqlserver_database.sql @@ -1,16 +1,16 @@ -use %TvLibrary% -GO - -CREATE TABLE "PendingDeletion"( - idPendingDeletion int IDENTITY(1,1) NOT NULL, - fileName varchar(200) NOT NULL - CONSTRAINT PK_PendingDeletion PRIMARY KEY -( - idPendingDeletion ASC -) -) - -GO - -UPDATE Version SET versionNumber=55 -GO +use %TvLibrary% +GO + +CREATE TABLE "PendingDeletion"( + idPendingDeletion int IDENTITY(1,1) NOT NULL, + fileName varchar(200) NOT NULL + CONSTRAINT PK_PendingDeletion PRIMARY KEY +( + idPendingDeletion ASC +) +) + +GO + +UPDATE Version SET versionNumber=55 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/56_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/56_upgrade_mysql_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/56_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/56_upgrade_mysql_database.sql index 24a19c4d192..fcd09b064c5 100644 --- a/TvEngine3/TVLibrary/SetupTv/56_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/56_upgrade_mysql_database.sql @@ -1,7 +1,7 @@ -USE %TvLibrary%; - -ALTER TABLE "TuningDetail" DROP COLUMN "pcrPid"; -ALTER TABLE "TuningDetail" DROP COLUMN "videoPid"; -ALTER TABLE "TuningDetail" DROP COLUMN "audioPid"; - -UPDATE Version SET versionNumber=56; +USE %TvLibrary%; + +ALTER TABLE "TuningDetail" DROP COLUMN "pcrPid"; +ALTER TABLE "TuningDetail" DROP COLUMN "videoPid"; +ALTER TABLE "TuningDetail" DROP COLUMN "audioPid"; + +UPDATE Version SET versionNumber=56; diff --git a/TvEngine3/TVLibrary/SetupTv/56_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/56_upgrade_sqlserver_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/56_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/56_upgrade_sqlserver_database.sql index 4246f7e58a3..7fa9f245514 100644 --- a/TvEngine3/TVLibrary/SetupTv/56_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/56_upgrade_sqlserver_database.sql @@ -1,49 +1,49 @@ -use %TvLibrary% -GO - -DROP INDEX [IX_TuningDetail_idChannel] ON [dbo].[TuningDetail] WITH ( ONLINE = OFF ) -GO - -CREATE NONCLUSTERED INDEX [IX_TuningDetail_idChannel] ON [dbo].[TuningDetail] -( - [idChannel] ASC -) -INCLUDE ( [idTuning], -[name], -[provider], -[channelType], -[channelNumber], -[frequency], -[countryId], -[isRadio], -[isTv], -[networkId], -[transportId], -[serviceId], -[pmtPid], -[freeToAir], -[modulation], -[polarisation], -[symbolrate], -[diseqc], -[switchingFrequency], -[bandwidth], -[majorChannel], -[minorChannel], -[videoSource], -[tuningSource]) WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] -GO - -ALTER TABLE TuningDetail - DROP COLUMN pcrPid -GO - -ALTER TABLE TuningDetail - DROP COLUMN videoPid -GO - -ALTER TABLE TuningDetail - DROP COLUMN audioPid -GO -UPDATE Version SET versionNumber=56 -GO +use %TvLibrary% +GO + +DROP INDEX [IX_TuningDetail_idChannel] ON [dbo].[TuningDetail] WITH ( ONLINE = OFF ) +GO + +CREATE NONCLUSTERED INDEX [IX_TuningDetail_idChannel] ON [dbo].[TuningDetail] +( + [idChannel] ASC +) +INCLUDE ( [idTuning], +[name], +[provider], +[channelType], +[channelNumber], +[frequency], +[countryId], +[isRadio], +[isTv], +[networkId], +[transportId], +[serviceId], +[pmtPid], +[freeToAir], +[modulation], +[polarisation], +[symbolrate], +[diseqc], +[switchingFrequency], +[bandwidth], +[majorChannel], +[minorChannel], +[videoSource], +[tuningSource]) WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +GO + +ALTER TABLE TuningDetail + DROP COLUMN pcrPid +GO + +ALTER TABLE TuningDetail + DROP COLUMN videoPid +GO + +ALTER TABLE TuningDetail + DROP COLUMN audioPid +GO +UPDATE Version SET versionNumber=56 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/57_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/57_upgrade_mysql_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/57_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/57_upgrade_mysql_database.sql index c4e32ae6e20..ce21e48be7c 100644 --- a/TvEngine3/TVLibrary/SetupTv/57_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/57_upgrade_mysql_database.sql @@ -1,7 +1,7 @@ -USE %TvLibrary%; - -ALTER TABLE Channel DROP COLUMN name; -ALTER TABLE Channel DROP COLUMN freetoair; - - -UPDATE Version SET versionNumber=57; +USE %TvLibrary%; + +ALTER TABLE Channel DROP COLUMN name; +ALTER TABLE Channel DROP COLUMN freetoair; + + +UPDATE Version SET versionNumber=57; diff --git a/TvEngine3/TVLibrary/SetupTv/57_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/57_upgrade_sqlserver_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/57_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/57_upgrade_sqlserver_database.sql index 38458246f45..3a434decde1 100644 --- a/TvEngine3/TVLibrary/SetupTv/57_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/57_upgrade_sqlserver_database.sql @@ -1,28 +1,28 @@ -USE %TvLibrary% -GO - -DROP INDEX [IX_Channel_IsTV] ON [dbo].[Channel] WITH ( ONLINE = OFF ) -GO - -CREATE NONCLUSTERED INDEX [IX_Channel_IsTV] ON [dbo].[Channel] -( - [isTv] ASC, - [sortOrder] ASC -) -INCLUDE ( [idChannel], -[isRadio], -[timesWatched], -[totalTimeWatched], -[grabEpg], -[lastGrabTime], -[visibleInGuide]) WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] -GO - -ALTER TABLE Channel DROP COLUMN "name" -GO - -ALTER TABLE Channel DROP COLUMN "freetoair" -GO - -UPDATE Version SET versionNumber=57 -GO +USE %TvLibrary% +GO + +DROP INDEX [IX_Channel_IsTV] ON [dbo].[Channel] WITH ( ONLINE = OFF ) +GO + +CREATE NONCLUSTERED INDEX [IX_Channel_IsTV] ON [dbo].[Channel] +( + [isTv] ASC, + [sortOrder] ASC +) +INCLUDE ( [idChannel], +[isRadio], +[timesWatched], +[totalTimeWatched], +[grabEpg], +[lastGrabTime], +[visibleInGuide]) WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +GO + +ALTER TABLE Channel DROP COLUMN "name" +GO + +ALTER TABLE Channel DROP COLUMN "freetoair" +GO + +UPDATE Version SET versionNumber=57 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/58_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/58_upgrade_mysql_database.sql similarity index 97% rename from TvEngine3/TVLibrary/SetupTv/58_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/58_upgrade_mysql_database.sql index 05143691b6f..a574e72d5bd 100644 --- a/TvEngine3/TVLibrary/SetupTv/58_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/58_upgrade_mysql_database.sql @@ -1,7 +1,7 @@ -USE %TvLibrary%; - -ALTER TABLE SoftwareEncoder ADD COLUMN reusable bit(1) NOT NULL DEFAULT 1; - -INSERT INTO Setting (tag, value) VALUE ('softwareEncoderReuseLimit', '0'); - +USE %TvLibrary%; + +ALTER TABLE SoftwareEncoder ADD COLUMN reusable bit(1) NOT NULL DEFAULT 1; + +INSERT INTO Setting (tag, value) VALUE ('softwareEncoderReuseLimit', '0'); + UPDATE Version SET versionNumber = 58; \ No newline at end of file diff --git a/TvEngine3/TVLibrary/SetupTv/58_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/58_upgrade_sqlserver_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/58_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/58_upgrade_sqlserver_database.sql index 3bb9cdb16c2..e663497f4c8 100644 --- a/TvEngine3/TVLibrary/SetupTv/58_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/58_upgrade_sqlserver_database.sql @@ -1,11 +1,11 @@ -USE %TvLibrary% -GO - -ALTER TABLE SoftwareEncoder ADD "reusable" bit NOT NULL DEFAULT 1 -GO - -INSERT INTO Setting (tag, value) VALUES ('softwareEncoderReuseLimit', '0') -GO - -UPDATE Version SET versionNumber = 58 -GO +USE %TvLibrary% +GO + +ALTER TABLE SoftwareEncoder ADD "reusable" bit NOT NULL DEFAULT 1 +GO + +INSERT INTO Setting (tag, value) VALUES ('softwareEncoderReuseLimit', '0') +GO + +UPDATE Version SET versionNumber = 58 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/59_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/59_upgrade_mysql_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/59_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/59_upgrade_mysql_database.sql index 8d356a11e00..b048c7c1b5a 100644 --- a/TvEngine3/TVLibrary/SetupTv/59_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/59_upgrade_mysql_database.sql @@ -1,5 +1,5 @@ -USE %TvLibrary%; - -ALTER TABLE Card MODIFY stopgraph bit(1) NOT NULL DEFAULT 1; - +USE %TvLibrary%; + +ALTER TABLE Card MODIFY stopgraph bit(1) NOT NULL DEFAULT 1; + UPDATE Version SET versionNumber = 59; \ No newline at end of file diff --git a/TvEngine3/TVLibrary/SetupTv/59_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/59_upgrade_sqlserver_database.sql similarity index 93% rename from TvEngine3/TVLibrary/SetupTv/59_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/59_upgrade_sqlserver_database.sql index ab6251f8459..83e8a9bba1b 100644 --- a/TvEngine3/TVLibrary/SetupTv/59_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/59_upgrade_sqlserver_database.sql @@ -1,14 +1,14 @@ -use %TvLibrary% -GO - -alter table Card drop constraint DF_Card_stopgraph -GO - - -ALTER TABLE Card - ADD CONSTRAINT DF_Card_stopgraph - DEFAULT (1) FOR stopgraph -GO - -UPDATE Version SET versionNumber=59 -GO +use %TvLibrary% +GO + +alter table Card drop constraint DF_Card_stopgraph +GO + + +ALTER TABLE Card + ADD CONSTRAINT DF_Card_stopgraph + DEFAULT (1) FOR stopgraph +GO + +UPDATE Version SET versionNumber=59 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/60_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/60_upgrade_mysql_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/60_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/60_upgrade_mysql_database.sql index 2672b50f6cc..bbd353d339c 100644 --- a/TvEngine3/TVLibrary/SetupTv/60_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/60_upgrade_mysql_database.sql @@ -1,5 +1,5 @@ -USE %TvLibrary%; - -UPDATE Card SET stopgraph = 1; - +USE %TvLibrary%; + +UPDATE Card SET stopgraph = 1; + UPDATE Version SET versionNumber = 60; \ No newline at end of file diff --git a/TvEngine3/TVLibrary/SetupTv/60_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/60_upgrade_sqlserver_database.sql similarity index 92% rename from TvEngine3/TVLibrary/SetupTv/60_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/60_upgrade_sqlserver_database.sql index 97bb4522dd2..d3a0f59af68 100644 --- a/TvEngine3/TVLibrary/SetupTv/60_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/60_upgrade_sqlserver_database.sql @@ -1,8 +1,8 @@ -use %TvLibrary% -GO - -UPDATE Card SET stopgraph = 1 -GO - -UPDATE Version SET versionNumber=60 -GO +use %TvLibrary% +GO + +UPDATE Card SET stopgraph = 1 +GO + +UPDATE Version SET versionNumber=60 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/61_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/61_upgrade_mysql_database.sql similarity index 98% rename from TvEngine3/TVLibrary/SetupTv/61_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/61_upgrade_mysql_database.sql index fc9a48e7faa..c22452facb3 100644 --- a/TvEngine3/TVLibrary/SetupTv/61_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/61_upgrade_mysql_database.sql @@ -1,8 +1,8 @@ -USE %TvLibrary%; - -ALTER TABLE Channel ADD COLUMN channelNumber INT(11) NULL DEFAULT NULL; -UPDATE Channel c SET c.channelNumber = (SELECT t.channelNumber FROM TuningDetail t WHERE t.idChannel = c.idChannel ORDER BY t.idTuning LIMIT 1); -UPDATE Channel SET channelNumber = 10000 WHERE ISNULL(channelNumber); -ALTER TABLE Channel CHANGE channelNumber channelNumber INT(11) NOT NULL DEFAULT 10000; - -UPDATE Version SET versionNumber=61; +USE %TvLibrary%; + +ALTER TABLE Channel ADD COLUMN channelNumber INT(11) NULL DEFAULT NULL; +UPDATE Channel c SET c.channelNumber = (SELECT t.channelNumber FROM TuningDetail t WHERE t.idChannel = c.idChannel ORDER BY t.idTuning LIMIT 1); +UPDATE Channel SET channelNumber = 10000 WHERE ISNULL(channelNumber); +ALTER TABLE Channel CHANGE channelNumber channelNumber INT(11) NOT NULL DEFAULT 10000; + +UPDATE Version SET versionNumber=61; diff --git a/TvEngine3/TVLibrary/SetupTv/61_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/61_upgrade_sqlserver_database.sql similarity index 97% rename from TvEngine3/TVLibrary/SetupTv/61_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/61_upgrade_sqlserver_database.sql index 1553617b0ca..a80f03bc1de 100644 --- a/TvEngine3/TVLibrary/SetupTv/61_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/61_upgrade_sqlserver_database.sql @@ -1,8 +1,8 @@ -USE %TvLibrary%; -GO -ALTER TABLE Channel ADD channelNumber INT NOT NULL CONSTRAINT [DF_Channel_ChannelNumber] DEFAULT 10000 -GO -UPDATE Channel SET channelNumber = (SELECT TOP 1 t.channelNumber ORDER BY t.idTuning) FROM TuningDetail AS t INNER JOIN Channel AS c ON t.idChannel = c.idChannel -GO -UPDATE Version SET versionNumber=61 -GO +USE %TvLibrary%; +GO +ALTER TABLE Channel ADD channelNumber INT NOT NULL CONSTRAINT [DF_Channel_ChannelNumber] DEFAULT 10000 +GO +UPDATE Channel SET channelNumber = (SELECT TOP 1 t.channelNumber ORDER BY t.idTuning) FROM TuningDetail AS t INNER JOIN Channel AS c ON t.idChannel = c.idChannel +GO +UPDATE Version SET versionNumber=61 +GO diff --git a/TvEngine3/TVLibrary/SetupTv/62_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/62_upgrade_mysql_database.sql similarity index 100% rename from TvEngine3/TVLibrary/SetupTv/62_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/62_upgrade_mysql_database.sql diff --git a/TvEngine3/TVLibrary/SetupTv/62_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/62_upgrade_sqlserver_database.sql similarity index 100% rename from TvEngine3/TVLibrary/SetupTv/62_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/62_upgrade_sqlserver_database.sql diff --git a/TvEngine3/TVLibrary/SetupTv/create_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/create_mysql_database.sql similarity index 95% rename from TvEngine3/TVLibrary/SetupTv/create_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/create_mysql_database.sql index 4b5fdab7fbc..5710ef34238 100644 --- a/TvEngine3/TVLibrary/SetupTv/create_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/create_mysql_database.sql @@ -1,599 +1,611 @@ --- MySQL Administrator dump 1.4 --- --- ------------------------------------------------------ --- Server version 5.0.51a-community-nt - - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI_QUOTES' */; - --- --- Delete schema TvLibrary --- -DROP DATABASE IF EXISTS %TvLibrary%; - --- --- Create schema TvLibrary --- - -CREATE DATABASE IF NOT EXISTS %TvLibrary%; -USE %TvLibrary%; -# --- --- Definition of table `CanceledSchedule` --- -CREATE TABLE "CanceledSchedule" ( - "idCanceledSchedule" int(11) NOT NULL auto_increment, - "idSchedule" int(11) NOT NULL, - "cancelDateTime" datetime NOT NULL, - PRIMARY KEY ("idCanceledSchedule"), - KEY "FK_CanceledSchedule_Schedule" ("idSchedule") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "CanceledSchedule" --- - --- --- Definition of table "Card" --- -CREATE TABLE "Card" ( - "idCard" int(11) NOT NULL auto_increment, - "devicePath" varchar(2000) NOT NULL, - "name" varchar(200) NOT NULL, - "priority" int(11) NOT NULL, - "grabEPG" bit(1) NOT NULL, - "lastEpgGrab" datetime NOT NULL, - "recordingFolder" varchar(255) NOT NULL, - "idServer" int(11) NOT NULL, - "enabled" bit(1) NOT NULL, - "camType" int(11) NOT NULL, - "timeshiftingFolder" varchar(255) NOT NULL, - "recordingFormat" int(11) NOT NULL, - "decryptLimit" int(11) NOT NULL, - PRIMARY KEY ("idCard"), - KEY "FK_Card_Server" ("idServer") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Card" --- - --- --- Definition of table "CardGroup" --- -CREATE TABLE "CardGroup" ( - "idCardGroup" int(11) NOT NULL auto_increment, - "name" varchar(255) NOT NULL, - PRIMARY KEY ("idCardGroup") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "CardGroup" --- - --- --- Definition of table "CardGroupMap" --- -CREATE TABLE "CardGroupMap" ( - "idMapping" int(11) NOT NULL auto_increment, - "idCard" int(11) NOT NULL, - "idCardGroup" int(11) NOT NULL, - PRIMARY KEY ("idMapping"), - KEY "FK_CardGroupMap_Card" ("idCard"), - KEY "FK_CardGroupMap_CardGroup" ("idCardGroup") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "CardGroupMap" --- - --- --- Definition of table "Channel" --- -CREATE TABLE "Channel" ( - "idChannel" int(11) NOT NULL auto_increment, - "name" varchar(200) NOT NULL, - "isRadio" bit(1) NOT NULL, - "isTv" bit(1) NOT NULL, - "timesWatched" int(11) NOT NULL, - "totalTimeWatched" datetime NOT NULL, - "grabEpg" bit(1) NOT NULL, - "lastGrabTime" datetime NOT NULL, - "sortOrder" int(11) NOT NULL, - "visibleInGuide" bit(1) NOT NULL, - "externalId" varchar(200) NOT NULL, - "freetoair" bit(1) NOT NULL, - "displayName" varchar(200) NOT NULL, - "epgHasGaps" bit(1) default NULL, - PRIMARY KEY ("idChannel"), - KEY "idxChannel" ("isTv","sortOrder"), - KEY "idxChannelRadio" ("isRadio") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Channel" --- -update Channel set "epgHasGaps"=0; - --- --- Definition of table "ChannelGroup" --- -CREATE TABLE "ChannelGroup" ( - "idGroup" int(11) NOT NULL auto_increment, - "groupName" varchar(200) NOT NULL, - "sortOrder" int(11) NOT NULL, - PRIMARY KEY ("idGroup"), - KEY "IDX_ChannelGroup" ("sortOrder") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "ChannelGroup" --- - --- --- Definition of table "ChannelLinkageMap" --- -CREATE TABLE "ChannelLinkageMap" ( - "idMapping" int(11) NOT NULL auto_increment, - "idPortalChannel" int(11) NOT NULL, - "idLinkedChannel" int(11) NOT NULL, - PRIMARY KEY ("idMapping") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "ChannelLinkageMap" --- - --- --- Definition of table "ChannelMap" --- -CREATE TABLE "ChannelMap" ( - "idChannelMap" int(11) NOT NULL auto_increment, - "idChannel" int(11) NOT NULL, - "idCard" int(11) NOT NULL, - "epgOnly" bit(1) default NULL, - PRIMARY KEY ("idChannelMap"), - KEY "FK_ChannelMap_Cards" ("idCard"), - KEY "FK_ChannelMap_Channels" ("idChannel") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "ChannelMap" --- -update ChannelMap set "epgOnly"=0; - --- --- Definition of table "Conflict" --- -CREATE TABLE "Conflict" ( - "idConflict" int(11) NOT NULL auto_increment, - "idSchedule" int(11) NOT NULL, - "idConflictingSchedule" int(11) NOT NULL, - "idChannel" int(11) NOT NULL, - "conflictDate" datetime NOT NULL, - "idCard" int(11) default NULL, - PRIMARY KEY ("idConflict"), - KEY "FK_Conflict_Channel" ("idChannel"), - KEY "FK_Conflict_Schedule" ("idSchedule"), - KEY "FK_Conflict_Schedule1" ("idConflictingSchedule") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Conflict" --- - --- --- Definition of table "DiSEqCMotor" --- -CREATE TABLE "DiSEqCMotor" ( - "idDiSEqCMotor" int(11) NOT NULL auto_increment, - "idCard" int(11) NOT NULL, - "idSatellite" int(11) NOT NULL, - "position" int(11) NOT NULL, - PRIMARY KEY ("idDiSEqCMotor"), - KEY "FK_DisEqcMotor_Satellite" ("idSatellite"), - KEY "FK_DisEqcMotor_Card" ("idCard") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "DiSEqCMotor" --- - --- --- Definition of table "Favorite" --- -CREATE TABLE "Favorite" ( - "idFavorite" int(11) NOT NULL auto_increment, - "idProgram" int(11) NOT NULL, - "priority" int(11) NOT NULL, - "timesWatched" int(11) NOT NULL, - PRIMARY KEY ("idFavorite"), - KEY "FK_Favorites_Programs" ("idProgram") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Favorite" --- - --- --- Definition of table "GroupMap" --- -CREATE TABLE "GroupMap" ( - "idMap" int(11) NOT NULL auto_increment, - "idGroup" int(11) NOT NULL, - "idChannel" int(11) NOT NULL, - "SortOrder" int(11) NOT NULL, - PRIMARY KEY ("idMap"), - KEY "FK_GroupMap_Channel" ("idChannel"), - KEY "FK_GroupMap_ChannelGroup" ("idGroup") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "GroupMap" --- - --- --- Definition of table "History" --- -CREATE TABLE "History" ( - "idHistory" int(11) NOT NULL auto_increment, - "idChannel" int(11) NOT NULL, - "startTime" datetime NOT NULL, - "endTime" datetime NOT NULL, - "title" varchar(1000) NOT NULL, - "description" text NOT NULL, - "genre" varchar(1000) NOT NULL, - "recorded" bit(1) NOT NULL, - "watched" int(11) NOT NULL, - PRIMARY KEY ("idHistory"), - KEY "FK_History_Channel" ("idChannel") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "History" --- - --- --- Definition of table "Keyword" --- -CREATE TABLE "Keyword" ( - "idKeyword" int(11) NOT NULL auto_increment, - "keywordName" varchar(200) NOT NULL, - "rating" int(11) NOT NULL, - "autoRecord" bit(1) NOT NULL, - "searchIn" int(11) NOT NULL, - PRIMARY KEY ("idKeyword") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Keyword" --- - --- --- Definition of table "KeywordMap" --- -CREATE TABLE "KeywordMap" ( - "idKeywordMap" int(11) NOT NULL auto_increment, - "idKeyword" int(11) NOT NULL, - "idChannelGroup" int(11) NOT NULL, - PRIMARY KEY ("idKeywordMap") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "KeywordMap" --- - --- --- Definition of table "PersonalTVGuideMap" --- -CREATE TABLE "PersonalTVGuideMap" ( - "idPersonalTVGuideMap" int(11) NOT NULL auto_increment, - "idKeyword" int(11) NOT NULL, - "idProgram" int(11) NOT NULL, - PRIMARY KEY ("idPersonalTVGuideMap") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "PersonalTVGuideMap" --- - --- --- Definition of table "Program" --- -CREATE TABLE "Program" ( - "idProgram" int(11) NOT NULL auto_increment, - "idChannel" int(11) NOT NULL, - "startTime" datetime NOT NULL, - "endTime" datetime NOT NULL, - "title" varchar(2000) NOT NULL, - "description" text NOT NULL, - "seriesNum" varchar(200) NOT NULL, - "episodeNum" varchar(200) NOT NULL, - "genre" varchar(200) NOT NULL, - "originalAirDate" datetime NOT NULL, - "classification" varchar(200) NOT NULL, - "starRating" int(11) NOT NULL, - "notify" bit(1) NOT NULL, - "parentalRating" int(11) NOT NULL, - PRIMARY KEY ("idProgram"), - UNIQUE KEY "idProgramBeginEnd" ("idChannel","startTime","endTime") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Program" --- - --- --- Definition of table "RadioChannelGroup" --- -CREATE TABLE "RadioChannelGroup" ( - "idGroup" int(11) NOT NULL auto_increment, - "groupName" varchar(200) NOT NULL, - "sortOrder" int(11) NOT NULL, - PRIMARY KEY ("idGroup"), - KEY "IDX_RadioChannelGroup" ("sortOrder") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "RadioChannelGroup" --- - --- --- Definition of table "RadioGroupMap" --- -CREATE TABLE "RadioGroupMap" ( - "idMap" int(11) NOT NULL auto_increment, - "idGroup" int(11) NOT NULL, - "idChannel" int(11) NOT NULL, - "SortOrder" int(11) NOT NULL, - PRIMARY KEY ("idMap"), - KEY "FK_RadioGroupMap_Channel" ("idChannel"), - KEY "FK_RadioGroupMap_ChannelGroup" ("idGroup"), - KEY "IDX_RadioGroupMap_SortOrder" ("SortOrder") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "RadioGroupMap" --- - --- --- Definition of table "Recording" --- -CREATE TABLE "Recording" ( - "idRecording" int(11) NOT NULL auto_increment, - "idChannel" int(11) NOT NULL, - "startTime" datetime NOT NULL, - "endTime" datetime NOT NULL, - "title" varchar(2000) NOT NULL, - "description" varchar(8000) NOT NULL, - "genre" varchar(200) NOT NULL, - "fileName" varchar(1024) NOT NULL, - "keepUntil" int(11) NOT NULL, - "keepUntilDate" datetime NOT NULL, - "timesWatched" int(11) NOT NULL, - "idServer" int(11) NOT NULL, - "stopTime" int(11) NOT NULL, - PRIMARY KEY ("idRecording"), - KEY "FK_Recording_Server" ("idServer"), - KEY "FK_Recordings_Channels" ("idChannel") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Recording" --- - --- --- Definition of table "Satellite" --- -CREATE TABLE "Satellite" ( - "idSatellite" int(11) NOT NULL auto_increment, - "satelliteName" varchar(200) NOT NULL, - "transponderFileName" varchar(200) NOT NULL, - PRIMARY KEY ("idSatellite") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Satellite" --- - --- --- Definition of table "Schedule" --- -CREATE TABLE "Schedule" ( - "id_Schedule" int(11) NOT NULL auto_increment, - "idChannel" int(11) NOT NULL, - "scheduleType" int(11) NOT NULL, - "programName" varchar(255) NOT NULL, - "startTime" datetime NOT NULL, - "endTime" datetime NOT NULL, - "maxAirings" int(11) NOT NULL, - "priority" int(11) NOT NULL, - "directory" varchar(1024) NOT NULL, - "quality" int(11) NOT NULL, - "keepMethod" int(11) NOT NULL, - "keepDate" datetime NOT NULL, - "preRecordInterval" int(11) NOT NULL, - "postRecordInterval" int(11) NOT NULL, - "canceled" datetime NOT NULL, - "recommendedCard" int(11) NOT NULL, - PRIMARY KEY ("id_Schedule"), - KEY "FK_Schedule_Channel" ("idChannel"), - KEY "IDX_Schedule_ScheduleType" ("scheduleType"), - KEY "IDX_Schedule_ProgramName" ("programName"), - KEY "IDX_Schedule_StartTime" ("startTime"), - KEY "IDX_Schedule_EndTime" ("endTime") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Schedule" --- - --- --- Definition of table "Server" --- -CREATE TABLE "Server" ( - "idServer" int(11) NOT NULL auto_increment, - "isMaster" bit(1) NOT NULL, - "hostName" varchar(255) NOT NULL, - PRIMARY KEY ("idServer") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Server" --- - --- --- Definition of table "Setting" --- -CREATE TABLE "Setting" ( - "idSetting" int(11) NOT NULL auto_increment, - "tag" varchar(200) NOT NULL, - "value" varchar(4096) NOT NULL, - PRIMARY KEY ("idSetting"), - KEY "IDX_Setting_Tag" ("tag") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Setting" --- - --- --- Definition of table "Timespan" --- -CREATE TABLE "Timespan" ( - "idTimespan" int(11) NOT NULL auto_increment, - "idKeyword" int(11) NOT NULL, - "startTime" datetime NOT NULL, - "endTime" datetime NOT NULL, - "dayOfWeek" int(11) NOT NULL, - PRIMARY KEY ("idTimespan") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Timespan" --- - --- --- Definition of table "TuningDetail" --- -CREATE TABLE "TuningDetail" ( - "idTuning" int(11) NOT NULL auto_increment, - "idChannel" int(11) NOT NULL, - "name" varchar(200) NOT NULL, - "provider" varchar(200) NOT NULL, - "channelType" int(11) NOT NULL, - "channelNumber" int(11) NOT NULL, - "frequency" int(11) NOT NULL, - "countryId" int(11) NOT NULL, - "isRadio" bit(1) NOT NULL, - "isTv" bit(1) NOT NULL, - "networkId" int(11) NOT NULL, - "transportId" int(11) NOT NULL, - "serviceId" int(11) NOT NULL, - "pmtPid" int(11) NOT NULL, - "freeToAir" bit(1) NOT NULL, - "modulation" int(11) NOT NULL, - "polarisation" int(11) NOT NULL, - "symbolrate" int(11) NOT NULL, - "diseqc" int(11) NOT NULL, - "switchingFrequency" int(11) NOT NULL, - "bandwidth" int(11) NOT NULL, - "majorChannel" int(11) NOT NULL, - "minorChannel" int(11) NOT NULL, - "pcrPid" int(11) NOT NULL, - "videoSource" int(11) NOT NULL, - "tuningSource" int(11) NOT NULL, - "videoPid" int(11) NOT NULL, - "audioPid" int(11) NOT NULL, - "band" int(11) NOT NULL, - "satIndex" int(11) NOT NULL, - "innerFecRate" int(11) NOT NULL, - "pilot" int(11) NOT NULL, - "rollOff" int(11) NOT NULL, - "url" varchar(200) NOT NULL, - "bitrate" int(11) NOT NULL, - PRIMARY KEY ("idTuning"), - KEY "IDX_TuningDetail1" ("idChannel"), - KEY "IDX_TuningDetail_Edit" ("networkId","transportId","serviceId") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "TuningDetail" --- - --- --- Definition of table "TvMovieMapping" --- -CREATE TABLE "TvMovieMapping" ( - "idMapping" int(11) NOT NULL auto_increment, - "idChannel" int(11) NOT NULL, - "stationName" varchar(200) NOT NULL, - "timeSharingStart" varchar(200) NOT NULL, - "timeSharingEnd" varchar(200) NOT NULL, - PRIMARY KEY ("idMapping"), - KEY "FK_TvMovieMapping_Channel" ("idChannel") -) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "TvMovieMapping" --- - --- --- Definition of table "Version" --- -CREATE TABLE "Version" ( - "idVersion" int(11) NOT NULL auto_increment, - "versionNumber" int(11) NOT NULL, - PRIMARY KEY ("idVersion") -) ENGINE=INNODB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; -# - --- --- Dumping data for table "Version" --- -INSERT INTO "Version" ("idVersion","versionNumber") VALUES - (1,38); - - - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +-- MySQL Administrator dump 1.4 +-- +-- ------------------------------------------------------ +-- Server version 5.0.51a-community-nt + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI_QUOTES' */; + +-- +-- Monkey patch +-- + +CREATE DATABASE IF NOT EXISTS %TvLibrary%; +# +-- +-- Delete schema TVLibrary +-- + +DROP DATABASE IF EXISTS %TvLibrary%; +# +-- +-- Create schema TVLibrary +-- + +CREATE DATABASE IF NOT EXISTS %TvLibrary%; +# +-- +-- Switch to TVLibrary schema +-- + +USE %TvLibrary%; +# +-- +-- Definition of table `CanceledSchedule` +-- +CREATE TABLE "CanceledSchedule" ( + "idCanceledSchedule" int(11) NOT NULL auto_increment, + "idSchedule" int(11) NOT NULL, + "cancelDateTime" datetime NOT NULL, + PRIMARY KEY ("idCanceledSchedule"), + KEY "FK_CanceledSchedule_Schedule" ("idSchedule") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "CanceledSchedule" +-- + +-- +-- Definition of table "Card" +-- +CREATE TABLE "Card" ( + "idCard" int(11) NOT NULL auto_increment, + "devicePath" varchar(2000) NOT NULL, + "name" varchar(200) NOT NULL, + "priority" int(11) NOT NULL, + "grabEPG" bit(1) NOT NULL, + "lastEpgGrab" datetime NOT NULL, + "recordingFolder" varchar(255) NOT NULL, + "idServer" int(11) NOT NULL, + "enabled" bit(1) NOT NULL, + "camType" int(11) NOT NULL, + "timeshiftingFolder" varchar(255) NOT NULL, + "recordingFormat" int(11) NOT NULL, + "decryptLimit" int(11) NOT NULL, + PRIMARY KEY ("idCard"), + KEY "FK_Card_Server" ("idServer") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Card" +-- + +-- +-- Definition of table "CardGroup" +-- +CREATE TABLE "CardGroup" ( + "idCardGroup" int(11) NOT NULL auto_increment, + "name" varchar(255) NOT NULL, + PRIMARY KEY ("idCardGroup") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "CardGroup" +-- + +-- +-- Definition of table "CardGroupMap" +-- +CREATE TABLE "CardGroupMap" ( + "idMapping" int(11) NOT NULL auto_increment, + "idCard" int(11) NOT NULL, + "idCardGroup" int(11) NOT NULL, + PRIMARY KEY ("idMapping"), + KEY "FK_CardGroupMap_Card" ("idCard"), + KEY "FK_CardGroupMap_CardGroup" ("idCardGroup") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "CardGroupMap" +-- + +-- +-- Definition of table "Channel" +-- +CREATE TABLE "Channel" ( + "idChannel" int(11) NOT NULL auto_increment, + "name" varchar(200) NOT NULL, + "isRadio" bit(1) NOT NULL, + "isTv" bit(1) NOT NULL, + "timesWatched" int(11) NOT NULL, + "totalTimeWatched" datetime NOT NULL, + "grabEpg" bit(1) NOT NULL, + "lastGrabTime" datetime NOT NULL, + "sortOrder" int(11) NOT NULL, + "visibleInGuide" bit(1) NOT NULL, + "externalId" varchar(200) NOT NULL, + "freetoair" bit(1) NOT NULL, + "displayName" varchar(200) NOT NULL, + "epgHasGaps" bit(1) default NULL, + PRIMARY KEY ("idChannel"), + KEY "idxChannel" ("isTv","sortOrder"), + KEY "idxChannelRadio" ("isRadio") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Channel" +-- +update Channel set "epgHasGaps"=0; + +-- +-- Definition of table "ChannelGroup" +-- +CREATE TABLE "ChannelGroup" ( + "idGroup" int(11) NOT NULL auto_increment, + "groupName" varchar(200) NOT NULL, + "sortOrder" int(11) NOT NULL, + PRIMARY KEY ("idGroup"), + KEY "IDX_ChannelGroup" ("sortOrder") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "ChannelGroup" +-- + +-- +-- Definition of table "ChannelLinkageMap" +-- +CREATE TABLE "ChannelLinkageMap" ( + "idMapping" int(11) NOT NULL auto_increment, + "idPortalChannel" int(11) NOT NULL, + "idLinkedChannel" int(11) NOT NULL, + PRIMARY KEY ("idMapping") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "ChannelLinkageMap" +-- + +-- +-- Definition of table "ChannelMap" +-- +CREATE TABLE "ChannelMap" ( + "idChannelMap" int(11) NOT NULL auto_increment, + "idChannel" int(11) NOT NULL, + "idCard" int(11) NOT NULL, + "epgOnly" bit(1) default NULL, + PRIMARY KEY ("idChannelMap"), + KEY "FK_ChannelMap_Cards" ("idCard"), + KEY "FK_ChannelMap_Channels" ("idChannel") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "ChannelMap" +-- +update ChannelMap set "epgOnly"=0; + +-- +-- Definition of table "Conflict" +-- +CREATE TABLE "Conflict" ( + "idConflict" int(11) NOT NULL auto_increment, + "idSchedule" int(11) NOT NULL, + "idConflictingSchedule" int(11) NOT NULL, + "idChannel" int(11) NOT NULL, + "conflictDate" datetime NOT NULL, + "idCard" int(11) default NULL, + PRIMARY KEY ("idConflict"), + KEY "FK_Conflict_Channel" ("idChannel"), + KEY "FK_Conflict_Schedule" ("idSchedule"), + KEY "FK_Conflict_Schedule1" ("idConflictingSchedule") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Conflict" +-- + +-- +-- Definition of table "DiSEqCMotor" +-- +CREATE TABLE "DiSEqCMotor" ( + "idDiSEqCMotor" int(11) NOT NULL auto_increment, + "idCard" int(11) NOT NULL, + "idSatellite" int(11) NOT NULL, + "position" int(11) NOT NULL, + PRIMARY KEY ("idDiSEqCMotor"), + KEY "FK_DisEqcMotor_Satellite" ("idSatellite"), + KEY "FK_DisEqcMotor_Card" ("idCard") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "DiSEqCMotor" +-- + +-- +-- Definition of table "Favorite" +-- +CREATE TABLE "Favorite" ( + "idFavorite" int(11) NOT NULL auto_increment, + "idProgram" int(11) NOT NULL, + "priority" int(11) NOT NULL, + "timesWatched" int(11) NOT NULL, + PRIMARY KEY ("idFavorite"), + KEY "FK_Favorites_Programs" ("idProgram") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Favorite" +-- + +-- +-- Definition of table "GroupMap" +-- +CREATE TABLE "GroupMap" ( + "idMap" int(11) NOT NULL auto_increment, + "idGroup" int(11) NOT NULL, + "idChannel" int(11) NOT NULL, + "SortOrder" int(11) NOT NULL, + PRIMARY KEY ("idMap"), + KEY "FK_GroupMap_Channel" ("idChannel"), + KEY "FK_GroupMap_ChannelGroup" ("idGroup") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "GroupMap" +-- + +-- +-- Definition of table "History" +-- +CREATE TABLE "History" ( + "idHistory" int(11) NOT NULL auto_increment, + "idChannel" int(11) NOT NULL, + "startTime" datetime NOT NULL, + "endTime" datetime NOT NULL, + "title" varchar(1000) NOT NULL, + "description" text NOT NULL, + "genre" varchar(1000) NOT NULL, + "recorded" bit(1) NOT NULL, + "watched" int(11) NOT NULL, + PRIMARY KEY ("idHistory"), + KEY "FK_History_Channel" ("idChannel") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "History" +-- + +-- +-- Definition of table "Keyword" +-- +CREATE TABLE "Keyword" ( + "idKeyword" int(11) NOT NULL auto_increment, + "keywordName" varchar(200) NOT NULL, + "rating" int(11) NOT NULL, + "autoRecord" bit(1) NOT NULL, + "searchIn" int(11) NOT NULL, + PRIMARY KEY ("idKeyword") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Keyword" +-- + +-- +-- Definition of table "KeywordMap" +-- +CREATE TABLE "KeywordMap" ( + "idKeywordMap" int(11) NOT NULL auto_increment, + "idKeyword" int(11) NOT NULL, + "idChannelGroup" int(11) NOT NULL, + PRIMARY KEY ("idKeywordMap") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "KeywordMap" +-- + +-- +-- Definition of table "PersonalTVGuideMap" +-- +CREATE TABLE "PersonalTVGuideMap" ( + "idPersonalTVGuideMap" int(11) NOT NULL auto_increment, + "idKeyword" int(11) NOT NULL, + "idProgram" int(11) NOT NULL, + PRIMARY KEY ("idPersonalTVGuideMap") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "PersonalTVGuideMap" +-- + +-- +-- Definition of table "Program" +-- +CREATE TABLE "Program" ( + "idProgram" int(11) NOT NULL auto_increment, + "idChannel" int(11) NOT NULL, + "startTime" datetime NOT NULL, + "endTime" datetime NOT NULL, + "title" varchar(2000) NOT NULL, + "description" text NOT NULL, + "seriesNum" varchar(200) NOT NULL, + "episodeNum" varchar(200) NOT NULL, + "genre" varchar(200) NOT NULL, + "originalAirDate" datetime NOT NULL, + "classification" varchar(200) NOT NULL, + "starRating" int(11) NOT NULL, + "notify" bit(1) NOT NULL, + "parentalRating" int(11) NOT NULL, + PRIMARY KEY ("idProgram"), + UNIQUE KEY "idProgramBeginEnd" ("idChannel","startTime","endTime") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Program" +-- + +-- +-- Definition of table "RadioChannelGroup" +-- +CREATE TABLE "RadioChannelGroup" ( + "idGroup" int(11) NOT NULL auto_increment, + "groupName" varchar(200) NOT NULL, + "sortOrder" int(11) NOT NULL, + PRIMARY KEY ("idGroup"), + KEY "IDX_RadioChannelGroup" ("sortOrder") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "RadioChannelGroup" +-- + +-- +-- Definition of table "RadioGroupMap" +-- +CREATE TABLE "RadioGroupMap" ( + "idMap" int(11) NOT NULL auto_increment, + "idGroup" int(11) NOT NULL, + "idChannel" int(11) NOT NULL, + "SortOrder" int(11) NOT NULL, + PRIMARY KEY ("idMap"), + KEY "FK_RadioGroupMap_Channel" ("idChannel"), + KEY "FK_RadioGroupMap_ChannelGroup" ("idGroup"), + KEY "IDX_RadioGroupMap_SortOrder" ("SortOrder") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "RadioGroupMap" +-- + +-- +-- Definition of table "Recording" +-- +CREATE TABLE "Recording" ( + "idRecording" int(11) NOT NULL auto_increment, + "idChannel" int(11) NOT NULL, + "startTime" datetime NOT NULL, + "endTime" datetime NOT NULL, + "title" varchar(2000) NOT NULL, + "description" varchar(8000) NOT NULL, + "genre" varchar(200) NOT NULL, + "fileName" varchar(1024) NOT NULL, + "keepUntil" int(11) NOT NULL, + "keepUntilDate" datetime NOT NULL, + "timesWatched" int(11) NOT NULL, + "idServer" int(11) NOT NULL, + "stopTime" int(11) NOT NULL, + PRIMARY KEY ("idRecording"), + KEY "FK_Recording_Server" ("idServer"), + KEY "FK_Recordings_Channels" ("idChannel") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Recording" +-- + +-- +-- Definition of table "Satellite" +-- +CREATE TABLE "Satellite" ( + "idSatellite" int(11) NOT NULL auto_increment, + "satelliteName" varchar(200) NOT NULL, + "transponderFileName" varchar(200) NOT NULL, + PRIMARY KEY ("idSatellite") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Satellite" +-- + +-- +-- Definition of table "Schedule" +-- +CREATE TABLE "Schedule" ( + "id_Schedule" int(11) NOT NULL auto_increment, + "idChannel" int(11) NOT NULL, + "scheduleType" int(11) NOT NULL, + "programName" varchar(255) NOT NULL, + "startTime" datetime NOT NULL, + "endTime" datetime NOT NULL, + "maxAirings" int(11) NOT NULL, + "priority" int(11) NOT NULL, + "directory" varchar(1024) NOT NULL, + "quality" int(11) NOT NULL, + "keepMethod" int(11) NOT NULL, + "keepDate" datetime NOT NULL, + "preRecordInterval" int(11) NOT NULL, + "postRecordInterval" int(11) NOT NULL, + "canceled" datetime NOT NULL, + "recommendedCard" int(11) NOT NULL, + PRIMARY KEY ("id_Schedule"), + KEY "FK_Schedule_Channel" ("idChannel"), + KEY "IDX_Schedule_ScheduleType" ("scheduleType"), + KEY "IDX_Schedule_ProgramName" ("programName"), + KEY "IDX_Schedule_StartTime" ("startTime"), + KEY "IDX_Schedule_EndTime" ("endTime") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Schedule" +-- + +-- +-- Definition of table "Server" +-- +CREATE TABLE "Server" ( + "idServer" int(11) NOT NULL auto_increment, + "isMaster" bit(1) NOT NULL, + "hostName" varchar(255) NOT NULL, + PRIMARY KEY ("idServer") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Server" +-- + +-- +-- Definition of table "Setting" +-- +CREATE TABLE "Setting" ( + "idSetting" int(11) NOT NULL auto_increment, + "tag" varchar(200) NOT NULL, + "value" varchar(4096) NOT NULL, + PRIMARY KEY ("idSetting"), + KEY "IDX_Setting_Tag" ("tag") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Setting" +-- + +-- +-- Definition of table "Timespan" +-- +CREATE TABLE "Timespan" ( + "idTimespan" int(11) NOT NULL auto_increment, + "idKeyword" int(11) NOT NULL, + "startTime" datetime NOT NULL, + "endTime" datetime NOT NULL, + "dayOfWeek" int(11) NOT NULL, + PRIMARY KEY ("idTimespan") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Timespan" +-- + +-- +-- Definition of table "TuningDetail" +-- +CREATE TABLE "TuningDetail" ( + "idTuning" int(11) NOT NULL auto_increment, + "idChannel" int(11) NOT NULL, + "name" varchar(200) NOT NULL, + "provider" varchar(200) NOT NULL, + "channelType" int(11) NOT NULL, + "channelNumber" int(11) NOT NULL, + "frequency" int(11) NOT NULL, + "countryId" int(11) NOT NULL, + "isRadio" bit(1) NOT NULL, + "isTv" bit(1) NOT NULL, + "networkId" int(11) NOT NULL, + "transportId" int(11) NOT NULL, + "serviceId" int(11) NOT NULL, + "pmtPid" int(11) NOT NULL, + "freeToAir" bit(1) NOT NULL, + "modulation" int(11) NOT NULL, + "polarisation" int(11) NOT NULL, + "symbolrate" int(11) NOT NULL, + "diseqc" int(11) NOT NULL, + "switchingFrequency" int(11) NOT NULL, + "bandwidth" int(11) NOT NULL, + "majorChannel" int(11) NOT NULL, + "minorChannel" int(11) NOT NULL, + "pcrPid" int(11) NOT NULL, + "videoSource" int(11) NOT NULL, + "tuningSource" int(11) NOT NULL, + "videoPid" int(11) NOT NULL, + "audioPid" int(11) NOT NULL, + "band" int(11) NOT NULL, + "satIndex" int(11) NOT NULL, + "innerFecRate" int(11) NOT NULL, + "pilot" int(11) NOT NULL, + "rollOff" int(11) NOT NULL, + "url" varchar(200) NOT NULL, + "bitrate" int(11) NOT NULL, + PRIMARY KEY ("idTuning"), + KEY "IDX_TuningDetail1" ("idChannel"), + KEY "IDX_TuningDetail_Edit" ("networkId","transportId","serviceId") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "TuningDetail" +-- + +-- +-- Definition of table "TvMovieMapping" +-- +CREATE TABLE "TvMovieMapping" ( + "idMapping" int(11) NOT NULL auto_increment, + "idChannel" int(11) NOT NULL, + "stationName" varchar(200) NOT NULL, + "timeSharingStart" varchar(200) NOT NULL, + "timeSharingEnd" varchar(200) NOT NULL, + PRIMARY KEY ("idMapping"), + KEY "FK_TvMovieMapping_Channel" ("idChannel") +) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "TvMovieMapping" +-- + +-- +-- Definition of table "Version" +-- +CREATE TABLE "Version" ( + "idVersion" int(11) NOT NULL auto_increment, + "versionNumber" int(11) NOT NULL, + PRIMARY KEY ("idVersion") +) ENGINE=INNODB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; +# + +-- +-- Dumping data for table "Version" +-- +INSERT INTO "Version" ("idVersion","versionNumber") VALUES + (1,38); + + + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/TvEngine3/TVLibrary/SetupTv/create_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/create_sqlserver_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/create_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/create_sqlserver_database.sql index acbfc5c4f80..132630a6c44 100644 --- a/TvEngine3/TVLibrary/SetupTv/create_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/create_sqlserver_database.sql @@ -1,581 +1,581 @@ -use master - -IF EXISTS (SELECT name FROM sysdatabases WHERE name = N'%TvLibrary%') -BEGIN - ALTER DATABASE %TvLibrary% set read_only with rollback immediate - ALTER DATABASE %TvLibrary% set read_write with rollback immediate - DROP DATABASE %TvLibrary% -END -GO - -CREATE DATABASE %TvLibrary% -GO - -use %TvLibrary% -GO - - -CREATE TABLE ChannelGroup( - idGroup int IDENTITY(1,1) NOT NULL, - groupName varchar(200) NOT NULL, - sortOrder int NOT NULL, - CONSTRAINT PK_ChannelGroup PRIMARY KEY CLUSTERED -( - idGroup ASC -) -) -GO - - -CREATE NONCLUSTERED INDEX IDX_SortOrder ON ChannelGroup -( - sortOrder ASC -) -INCLUDE -( - idGroup, - groupName -) -GO - - -CREATE TABLE Setting( - idSetting int IDENTITY(1,1) NOT NULL, - tag varchar(200) NOT NULL, - value varchar(4096) NOT NULL, - CONSTRAINT PK_Setting PRIMARY KEY CLUSTERED -( - idSetting ASC -) -) -GO - -CREATE NONCLUSTERED INDEX IDX_Setting_Tag ON Setting -( - tag ASC -) -GO - -CREATE TABLE TvMovieMapping( - idMapping int IDENTITY(1,1) NOT NULL, - idChannel int NOT NULL, - stationName varchar(200) NOT NULL, - timeSharingStart varchar(200) NOT NULL, - timeSharingEnd varchar(200) NOT NULL, - CONSTRAINT PK_TvMovieMapping PRIMARY KEY CLUSTERED -( - idMapping ASC -) -) -GO - - -CREATE TABLE Satellite( - idSatellite int IDENTITY(1,1) NOT NULL, - satelliteName varchar(200) NOT NULL, - transponderFileName varchar(200) NOT NULL, - CONSTRAINT PK_Satellite PRIMARY KEY CLUSTERED -( - idSatellite ASC -) -) -GO - - -CREATE TABLE ChannelLinkageMap( - idMapping int IDENTITY(1,1) NOT NULL, - idPortalChannel int NOT NULL, - idLinkedChannel int NOT NULL, - CONSTRAINT PK_ChannelLinkageMap PRIMARY KEY CLUSTERED -( - idMapping ASC -) -) -GO - - -CREATE TABLE Keyword( - idKeyword int IDENTITY(1,1) NOT NULL, - keywordName varchar(200) NOT NULL, - rating int NOT NULL, - autoRecord bit NOT NULL, - searchIn int NOT NULL, - CONSTRAINT PK_Keyword PRIMARY KEY CLUSTERED -( - idKeyword ASC -) -) -GO - - -CREATE TABLE Timespan( - idTimespan int IDENTITY(1,1) NOT NULL, - idKeyword int NOT NULL, - startTime datetime NOT NULL, - endTime datetime NOT NULL, - dayOfWeek int NOT NULL, - CONSTRAINT PK_Timespan PRIMARY KEY CLUSTERED -( - idTimespan ASC -) -) -GO - - -CREATE TABLE CardGroup( - idCardGroup int IDENTITY(1,1) NOT NULL, - name varchar(255) NOT NULL, - CONSTRAINT PK_CardGroup PRIMARY KEY CLUSTERED -( - idCardGroup ASC -) -) -GO - - -CREATE TABLE RadioChannelGroup( - idGroup int IDENTITY(1,1) NOT NULL, - groupName varchar(200) NOT NULL, - sortOrder int NOT NULL, - CONSTRAINT PK_RadioChannelGroup PRIMARY KEY CLUSTERED -( - idGroup ASC -) -) -GO - - -CREATE NONCLUSTERED INDEX IDX_SortOrder ON RadioChannelGroup -( - sortOrder ASC -) -INCLUDE -( - idGroup, - groupName -) -GO - - -CREATE TABLE Version( - idVersion int IDENTITY(1,1) NOT NULL, - versionNumber int NOT NULL, - CONSTRAINT PK_Versi PRIMARY KEY CLUSTERED -( - idVersion ASC -) -) -GO - -INSERT INTO Version (versionNumber) VALUES (38) -GO - - -CREATE TABLE Server( - idServer int IDENTITY(1,1) NOT NULL, - isMaster bit NOT NULL, - hostName varchar(256) NOT NULL, - CONSTRAINT PK_Server PRIMARY KEY CLUSTERED -( - idServer ASC -) -) -GO - - -CREATE TABLE Channel( - idChannel int IDENTITY(1,1) NOT NULL, - name varchar(200) NOT NULL, - isRadio bit NOT NULL, - isTv bit NOT NULL, - timesWatched int NOT NULL, - totalTimeWatched datetime NOT NULL, - grabEpg bit NOT NULL, - lastGrabTime datetime NOT NULL, - sortOrder int NOT NULL, - visibleInGuide bit NOT NULL, - externalId varchar(200) NOT NULL, - freetoair bit NOT NULL, - displayName varchar(200) NOT NULL, - epgHasGaps bit NOT NULL, - CONSTRAINT PK_Channels PRIMARY KEY CLUSTERED -( - idChannel ASC -) -) -GO - -UPDATE Channel SET epgHasGaps=0 -GO - - -CREATE NONCLUSTERED INDEX IX_Channel_IsTV ON Channel -( - isTv ASC, - sortOrder ASC -) -INCLUDE -( - idChannel, - name, - isRadio, - timesWatched, - totalTimeWatched, - grabEpg, - lastGrabTime, - visibleInGuide -) -GO - - -CREATE TABLE KeywordMap( - idKeywordMap int IDENTITY(1,1) NOT NULL, - idKeyword int NOT NULL, - idChannelGroup int NOT NULL, - CONSTRAINT PK_KeywordMap PRIMARY KEY CLUSTERED -( - idKeywordMap ASC -) -) -GO - - -CREATE TABLE GroupMap( - idMap int IDENTITY(1,1) NOT NULL, - idGroup int NOT NULL, - idChannel int NOT NULL, - SortOrder int NOT NULL, - CONSTRAINT PK_GroupMap PRIMARY KEY CLUSTERED -( - idMap ASC -) -) -GO - - -CREATE TABLE DisEqcMotor( - idDiSEqCMotor int IDENTITY(1,1) NOT NULL, - idCard int NOT NULL, - idSatellite int NOT NULL, - position int NOT NULL, - CONSTRAINT PK_DisEqcMotor PRIMARY KEY CLUSTERED -( - idDiSEqCMotor ASC -) -) -GO - - -CREATE TABLE ChannelMap( - idChannelMap int IDENTITY(1,1) NOT NULL, - idChannel int NOT NULL, - idCard int NOT NULL, - epgOnly bit NOT NULL, - CONSTRAINT PK_ChannelMap PRIMARY KEY CLUSTERED -( - idChannelMap ASC -) -) -GO - -UPDATE ChannelMap SET epgOnly=0 -GO - - -CREATE TABLE CardGroupMap( - idMapping int IDENTITY(1,1) NOT NULL, - idCard int NOT NULL, - idCardGroup int NOT NULL, - CONSTRAINT PK_CardGroupMap PRIMARY KEY CLUSTERED -( - idMapping ASC -) -) -GO - - -CREATE TABLE PersonalTVGuideMap( - idPersonalTVGuideMap int IDENTITY(1,1) NOT NULL, - idKeyword int NOT NULL, - idProgram int NOT NULL, - CONSTRAINT PK_PersonalTVGuideMap PRIMARY KEY CLUSTERED -( - idPersonalTVGuideMap ASC -) -) -GO - - -CREATE TABLE Favorite( - idFavorite int IDENTITY(1,1) NOT NULL, - idProgram int NOT NULL, - priority int NOT NULL, - timesWatched int NOT NULL, - CONSTRAINT PK_Favorites PRIMARY KEY CLUSTERED -( - idFavorite ASC -) -) -GO - - -CREATE TABLE CanceledSchedule( - idCanceledSchedule int IDENTITY(1,1) NOT NULL, - idSchedule int NOT NULL, - cancelDateTime datetime NOT NULL, - CONSTRAINT PK_CanceledSchedule PRIMARY KEY CLUSTERED -( - idCanceledSchedule ASC -) -) -GO - - -CREATE TABLE Conflict( - idConflict int IDENTITY(1,1) NOT NULL, - idSchedule int NOT NULL, - idConflictingSchedule int NOT NULL, - idChannel int NOT NULL, - conflictDate datetime NOT NULL, - idCard int NULL, - CONSTRAINT PK_Conflict PRIMARY KEY CLUSTERED -( - idConflict ASC -) -) -GO - -CREATE TABLE RadioGroupMap( - idMap int IDENTITY(1,1) NOT NULL, - idGroup int NOT NULL, - idChannel int NOT NULL, - SortOrder int NOT NULL, - CONSTRAINT PK_RadioGroupMap PRIMARY KEY CLUSTERED -( - idMap ASC -) -) -GO - - -CREATE TABLE Card( - idCard int IDENTITY(1,1) NOT NULL, - devicePath varchar(2000) NOT NULL, - name varchar(200) NOT NULL, - priority int NOT NULL, - grabEPG bit NOT NULL, - lastEpgGrab datetime NOT NULL, - recordingFolder varchar(256) NOT NULL, - idServer int NOT NULL, - enabled bit NOT NULL, - camType int NOT NULL, - timeshiftingFolder varchar(256) NOT NULL, - recordingFormat int NOT NULL, - decryptLimit int NOT NULL, - CONSTRAINT PK_Cards PRIMARY KEY CLUSTERED -( - idCard ASC -) -) -GO - - -CREATE TABLE Recording( - idRecording int IDENTITY(1,1) NOT NULL, - idChannel int NOT NULL, - startTime datetime NOT NULL, - endTime datetime NOT NULL, - title varchar(2000) NOT NULL, - description varchar(8000) NOT NULL, - genre varchar(200) NOT NULL, - fileName varchar(1024) NOT NULL, - keepUntil int NOT NULL, - keepUntilDate datetime NOT NULL, - timesWatched int NOT NULL, - idServer int NOT NULL, - stopTime int NOT NULL, - CONSTRAINT PK_Recordings PRIMARY KEY CLUSTERED -( - idRecording ASC -) -) -GO - - -CREATE TABLE Program( - idProgram int IDENTITY(1,1) NOT NULL, - idChannel int NOT NULL, - startTime datetime NOT NULL, - endTime datetime NOT NULL, - title varchar(MAX) NOT NULL, - description varchar(MAX) NOT NULL, - seriesNum varchar(200) NOT NULL, - episodeNum varchar(200) NOT NULL, - genre varchar(200) NOT NULL, - originalAirDate datetime NOT NULL, - classification varchar(200) NOT NULL, - starRating int NOT NULL, - notify bit NOT NULL, - parentalRating int NOT NULL, - CONSTRAINT PK_Programs PRIMARY KEY CLUSTERED -( - idProgram ASC -) -) -GO - - -CREATE UNIQUE INDEX IX_Program_EPG_Lookup ON Program -( - idChannel ASC, - startTime ASC, - endTime ASC -) -INCLUDE -( - title, - description, - seriesNum, - episodeNum, - genre, - originalAirDate, - classification, - starRating, - notify, - parentalRating -) -GO - - -CREATE TABLE Schedule( - id_Schedule int IDENTITY(1,1) NOT NULL, - idChannel int NOT NULL, - scheduleType int NOT NULL, - programName varchar(256) NOT NULL, - startTime datetime NOT NULL, - endTime datetime NOT NULL, - maxAirings int NOT NULL, - priority int NOT NULL, - directory varchar(1024) NOT NULL, - quality int NOT NULL, - keepMethod int NOT NULL, - keepDate datetime NOT NULL, - preRecordInterval int NOT NULL, - postRecordInterval int NOT NULL, - canceled datetime NOT NULL, - recommendedCard int NOT NULL, - CONSTRAINT PK_Schedule PRIMARY KEY CLUSTERED -( - id_Schedule ASC -) -) -GO - -CREATE NONCLUSTERED INDEX IDX_Schedule_ScheduleType ON Schedule -( - scheduleType ASC -) -INCLUDE -( - idChannel, - programName, - startTime, - endTime -) -GO - -CREATE TABLE TuningDetail( - idTuning int IDENTITY(1,1) NOT NULL, - idChannel int NOT NULL, - name varchar(200) NOT NULL, - provider varchar(200) NOT NULL, - channelType int NOT NULL, - channelNumber int NOT NULL, - frequency int NOT NULL, - countryId int NOT NULL, - isRadio bit NOT NULL, - isTv bit NOT NULL, - networkId int NOT NULL, - transportId int NOT NULL, - serviceId int NOT NULL, - pmtPid int NOT NULL, - freeToAir bit NOT NULL, - modulation int NOT NULL, - polarisation int NOT NULL, - symbolrate int NOT NULL, - diseqc int NOT NULL, - switchingFrequency int NOT NULL, - bandwidth int NOT NULL, - majorChannel int NOT NULL, - minorChannel int NOT NULL, - pcrPid int NOT NULL, - videoSource int NOT NULL, - tuningSource int NOT NULL, - videoPid int NOT NULL, - audioPid int NOT NULL, - band int NOT NULL, - satIndex int NOT NULL, - innerFecRate int NOT NULL, - pilot int NOT NULL, - rollOff int NOT NULL, - url varchar(200) NOT NULL, - bitrate int NOT NULL, - CONSTRAINT PK_TuningDetail PRIMARY KEY CLUSTERED -( - idTuning ASC -) -) -GO - - -CREATE NONCLUSTERED INDEX IX_TuningDetail_idChannel ON TuningDetail -( - idChannel ASC -) -INCLUDE -( - idTuning, - name, - provider, - channelType, - channelNumber, - frequency, - countryId, - isRadio, - isTv, - networkId, - transportId, - serviceId, - pmtPid, - freeToAir, - modulation, - polarisation, - symbolrate, - diseqc, - switchingFrequency, - bandwidth, - majorChannel, - minorChannel, - pcrPid, - videoSource, - tuningSource -) -GO - - -CREATE TABLE History( - idHistory int IDENTITY(1,1) NOT NULL, - idChannel int NOT NULL, - startTime datetime NOT NULL, - endTime datetime NOT NULL, - title varchar(1000) NOT NULL, - description varchar(1000) NOT NULL, - genre varchar(1000) NOT NULL, - recorded bit NOT NULL, - watched int NOT NULL, - CONSTRAINT PK_History PRIMARY KEY CLUSTERED -( - idHistory ASC -) -) -GO +use master + +IF EXISTS (SELECT name FROM sysdatabases WHERE name = N'%TvLibrary%') +BEGIN + ALTER DATABASE %TvLibrary% set read_only with rollback immediate + ALTER DATABASE %TvLibrary% set read_write with rollback immediate + DROP DATABASE %TvLibrary% +END +GO + +CREATE DATABASE %TvLibrary% +GO + +use %TvLibrary% +GO + + +CREATE TABLE ChannelGroup( + idGroup int IDENTITY(1,1) NOT NULL, + groupName varchar(200) NOT NULL, + sortOrder int NOT NULL, + CONSTRAINT PK_ChannelGroup PRIMARY KEY CLUSTERED +( + idGroup ASC +) +) +GO + + +CREATE NONCLUSTERED INDEX IDX_SortOrder ON ChannelGroup +( + sortOrder ASC +) +INCLUDE +( + idGroup, + groupName +) +GO + + +CREATE TABLE Setting( + idSetting int IDENTITY(1,1) NOT NULL, + tag varchar(200) NOT NULL, + value varchar(4096) NOT NULL, + CONSTRAINT PK_Setting PRIMARY KEY CLUSTERED +( + idSetting ASC +) +) +GO + +CREATE NONCLUSTERED INDEX IDX_Setting_Tag ON Setting +( + tag ASC +) +GO + +CREATE TABLE TvMovieMapping( + idMapping int IDENTITY(1,1) NOT NULL, + idChannel int NOT NULL, + stationName varchar(200) NOT NULL, + timeSharingStart varchar(200) NOT NULL, + timeSharingEnd varchar(200) NOT NULL, + CONSTRAINT PK_TvMovieMapping PRIMARY KEY CLUSTERED +( + idMapping ASC +) +) +GO + + +CREATE TABLE Satellite( + idSatellite int IDENTITY(1,1) NOT NULL, + satelliteName varchar(200) NOT NULL, + transponderFileName varchar(200) NOT NULL, + CONSTRAINT PK_Satellite PRIMARY KEY CLUSTERED +( + idSatellite ASC +) +) +GO + + +CREATE TABLE ChannelLinkageMap( + idMapping int IDENTITY(1,1) NOT NULL, + idPortalChannel int NOT NULL, + idLinkedChannel int NOT NULL, + CONSTRAINT PK_ChannelLinkageMap PRIMARY KEY CLUSTERED +( + idMapping ASC +) +) +GO + + +CREATE TABLE Keyword( + idKeyword int IDENTITY(1,1) NOT NULL, + keywordName varchar(200) NOT NULL, + rating int NOT NULL, + autoRecord bit NOT NULL, + searchIn int NOT NULL, + CONSTRAINT PK_Keyword PRIMARY KEY CLUSTERED +( + idKeyword ASC +) +) +GO + + +CREATE TABLE Timespan( + idTimespan int IDENTITY(1,1) NOT NULL, + idKeyword int NOT NULL, + startTime datetime NOT NULL, + endTime datetime NOT NULL, + dayOfWeek int NOT NULL, + CONSTRAINT PK_Timespan PRIMARY KEY CLUSTERED +( + idTimespan ASC +) +) +GO + + +CREATE TABLE CardGroup( + idCardGroup int IDENTITY(1,1) NOT NULL, + name varchar(255) NOT NULL, + CONSTRAINT PK_CardGroup PRIMARY KEY CLUSTERED +( + idCardGroup ASC +) +) +GO + + +CREATE TABLE RadioChannelGroup( + idGroup int IDENTITY(1,1) NOT NULL, + groupName varchar(200) NOT NULL, + sortOrder int NOT NULL, + CONSTRAINT PK_RadioChannelGroup PRIMARY KEY CLUSTERED +( + idGroup ASC +) +) +GO + + +CREATE NONCLUSTERED INDEX IDX_SortOrder ON RadioChannelGroup +( + sortOrder ASC +) +INCLUDE +( + idGroup, + groupName +) +GO + + +CREATE TABLE Version( + idVersion int IDENTITY(1,1) NOT NULL, + versionNumber int NOT NULL, + CONSTRAINT PK_Versi PRIMARY KEY CLUSTERED +( + idVersion ASC +) +) +GO + +INSERT INTO Version (versionNumber) VALUES (38) +GO + + +CREATE TABLE Server( + idServer int IDENTITY(1,1) NOT NULL, + isMaster bit NOT NULL, + hostName varchar(256) NOT NULL, + CONSTRAINT PK_Server PRIMARY KEY CLUSTERED +( + idServer ASC +) +) +GO + + +CREATE TABLE Channel( + idChannel int IDENTITY(1,1) NOT NULL, + name varchar(200) NOT NULL, + isRadio bit NOT NULL, + isTv bit NOT NULL, + timesWatched int NOT NULL, + totalTimeWatched datetime NOT NULL, + grabEpg bit NOT NULL, + lastGrabTime datetime NOT NULL, + sortOrder int NOT NULL, + visibleInGuide bit NOT NULL, + externalId varchar(200) NOT NULL, + freetoair bit NOT NULL, + displayName varchar(200) NOT NULL, + epgHasGaps bit NOT NULL, + CONSTRAINT PK_Channels PRIMARY KEY CLUSTERED +( + idChannel ASC +) +) +GO + +UPDATE Channel SET epgHasGaps=0 +GO + + +CREATE NONCLUSTERED INDEX IX_Channel_IsTV ON Channel +( + isTv ASC, + sortOrder ASC +) +INCLUDE +( + idChannel, + name, + isRadio, + timesWatched, + totalTimeWatched, + grabEpg, + lastGrabTime, + visibleInGuide +) +GO + + +CREATE TABLE KeywordMap( + idKeywordMap int IDENTITY(1,1) NOT NULL, + idKeyword int NOT NULL, + idChannelGroup int NOT NULL, + CONSTRAINT PK_KeywordMap PRIMARY KEY CLUSTERED +( + idKeywordMap ASC +) +) +GO + + +CREATE TABLE GroupMap( + idMap int IDENTITY(1,1) NOT NULL, + idGroup int NOT NULL, + idChannel int NOT NULL, + SortOrder int NOT NULL, + CONSTRAINT PK_GroupMap PRIMARY KEY CLUSTERED +( + idMap ASC +) +) +GO + + +CREATE TABLE DisEqcMotor( + idDiSEqCMotor int IDENTITY(1,1) NOT NULL, + idCard int NOT NULL, + idSatellite int NOT NULL, + position int NOT NULL, + CONSTRAINT PK_DisEqcMotor PRIMARY KEY CLUSTERED +( + idDiSEqCMotor ASC +) +) +GO + + +CREATE TABLE ChannelMap( + idChannelMap int IDENTITY(1,1) NOT NULL, + idChannel int NOT NULL, + idCard int NOT NULL, + epgOnly bit NOT NULL, + CONSTRAINT PK_ChannelMap PRIMARY KEY CLUSTERED +( + idChannelMap ASC +) +) +GO + +UPDATE ChannelMap SET epgOnly=0 +GO + + +CREATE TABLE CardGroupMap( + idMapping int IDENTITY(1,1) NOT NULL, + idCard int NOT NULL, + idCardGroup int NOT NULL, + CONSTRAINT PK_CardGroupMap PRIMARY KEY CLUSTERED +( + idMapping ASC +) +) +GO + + +CREATE TABLE PersonalTVGuideMap( + idPersonalTVGuideMap int IDENTITY(1,1) NOT NULL, + idKeyword int NOT NULL, + idProgram int NOT NULL, + CONSTRAINT PK_PersonalTVGuideMap PRIMARY KEY CLUSTERED +( + idPersonalTVGuideMap ASC +) +) +GO + + +CREATE TABLE Favorite( + idFavorite int IDENTITY(1,1) NOT NULL, + idProgram int NOT NULL, + priority int NOT NULL, + timesWatched int NOT NULL, + CONSTRAINT PK_Favorites PRIMARY KEY CLUSTERED +( + idFavorite ASC +) +) +GO + + +CREATE TABLE CanceledSchedule( + idCanceledSchedule int IDENTITY(1,1) NOT NULL, + idSchedule int NOT NULL, + cancelDateTime datetime NOT NULL, + CONSTRAINT PK_CanceledSchedule PRIMARY KEY CLUSTERED +( + idCanceledSchedule ASC +) +) +GO + + +CREATE TABLE Conflict( + idConflict int IDENTITY(1,1) NOT NULL, + idSchedule int NOT NULL, + idConflictingSchedule int NOT NULL, + idChannel int NOT NULL, + conflictDate datetime NOT NULL, + idCard int NULL, + CONSTRAINT PK_Conflict PRIMARY KEY CLUSTERED +( + idConflict ASC +) +) +GO + +CREATE TABLE RadioGroupMap( + idMap int IDENTITY(1,1) NOT NULL, + idGroup int NOT NULL, + idChannel int NOT NULL, + SortOrder int NOT NULL, + CONSTRAINT PK_RadioGroupMap PRIMARY KEY CLUSTERED +( + idMap ASC +) +) +GO + + +CREATE TABLE Card( + idCard int IDENTITY(1,1) NOT NULL, + devicePath varchar(2000) NOT NULL, + name varchar(200) NOT NULL, + priority int NOT NULL, + grabEPG bit NOT NULL, + lastEpgGrab datetime NOT NULL, + recordingFolder varchar(256) NOT NULL, + idServer int NOT NULL, + enabled bit NOT NULL, + camType int NOT NULL, + timeshiftingFolder varchar(256) NOT NULL, + recordingFormat int NOT NULL, + decryptLimit int NOT NULL, + CONSTRAINT PK_Cards PRIMARY KEY CLUSTERED +( + idCard ASC +) +) +GO + + +CREATE TABLE Recording( + idRecording int IDENTITY(1,1) NOT NULL, + idChannel int NOT NULL, + startTime datetime NOT NULL, + endTime datetime NOT NULL, + title varchar(2000) NOT NULL, + description varchar(8000) NOT NULL, + genre varchar(200) NOT NULL, + fileName varchar(1024) NOT NULL, + keepUntil int NOT NULL, + keepUntilDate datetime NOT NULL, + timesWatched int NOT NULL, + idServer int NOT NULL, + stopTime int NOT NULL, + CONSTRAINT PK_Recordings PRIMARY KEY CLUSTERED +( + idRecording ASC +) +) +GO + + +CREATE TABLE Program( + idProgram int IDENTITY(1,1) NOT NULL, + idChannel int NOT NULL, + startTime datetime NOT NULL, + endTime datetime NOT NULL, + title varchar(MAX) NOT NULL, + description varchar(MAX) NOT NULL, + seriesNum varchar(200) NOT NULL, + episodeNum varchar(200) NOT NULL, + genre varchar(200) NOT NULL, + originalAirDate datetime NOT NULL, + classification varchar(200) NOT NULL, + starRating int NOT NULL, + notify bit NOT NULL, + parentalRating int NOT NULL, + CONSTRAINT PK_Programs PRIMARY KEY CLUSTERED +( + idProgram ASC +) +) +GO + + +CREATE UNIQUE INDEX IX_Program_EPG_Lookup ON Program +( + idChannel ASC, + startTime ASC, + endTime ASC +) +INCLUDE +( + title, + description, + seriesNum, + episodeNum, + genre, + originalAirDate, + classification, + starRating, + notify, + parentalRating +) +GO + + +CREATE TABLE Schedule( + id_Schedule int IDENTITY(1,1) NOT NULL, + idChannel int NOT NULL, + scheduleType int NOT NULL, + programName varchar(256) NOT NULL, + startTime datetime NOT NULL, + endTime datetime NOT NULL, + maxAirings int NOT NULL, + priority int NOT NULL, + directory varchar(1024) NOT NULL, + quality int NOT NULL, + keepMethod int NOT NULL, + keepDate datetime NOT NULL, + preRecordInterval int NOT NULL, + postRecordInterval int NOT NULL, + canceled datetime NOT NULL, + recommendedCard int NOT NULL, + CONSTRAINT PK_Schedule PRIMARY KEY CLUSTERED +( + id_Schedule ASC +) +) +GO + +CREATE NONCLUSTERED INDEX IDX_Schedule_ScheduleType ON Schedule +( + scheduleType ASC +) +INCLUDE +( + idChannel, + programName, + startTime, + endTime +) +GO + +CREATE TABLE TuningDetail( + idTuning int IDENTITY(1,1) NOT NULL, + idChannel int NOT NULL, + name varchar(200) NOT NULL, + provider varchar(200) NOT NULL, + channelType int NOT NULL, + channelNumber int NOT NULL, + frequency int NOT NULL, + countryId int NOT NULL, + isRadio bit NOT NULL, + isTv bit NOT NULL, + networkId int NOT NULL, + transportId int NOT NULL, + serviceId int NOT NULL, + pmtPid int NOT NULL, + freeToAir bit NOT NULL, + modulation int NOT NULL, + polarisation int NOT NULL, + symbolrate int NOT NULL, + diseqc int NOT NULL, + switchingFrequency int NOT NULL, + bandwidth int NOT NULL, + majorChannel int NOT NULL, + minorChannel int NOT NULL, + pcrPid int NOT NULL, + videoSource int NOT NULL, + tuningSource int NOT NULL, + videoPid int NOT NULL, + audioPid int NOT NULL, + band int NOT NULL, + satIndex int NOT NULL, + innerFecRate int NOT NULL, + pilot int NOT NULL, + rollOff int NOT NULL, + url varchar(200) NOT NULL, + bitrate int NOT NULL, + CONSTRAINT PK_TuningDetail PRIMARY KEY CLUSTERED +( + idTuning ASC +) +) +GO + + +CREATE NONCLUSTERED INDEX IX_TuningDetail_idChannel ON TuningDetail +( + idChannel ASC +) +INCLUDE +( + idTuning, + name, + provider, + channelType, + channelNumber, + frequency, + countryId, + isRadio, + isTv, + networkId, + transportId, + serviceId, + pmtPid, + freeToAir, + modulation, + polarisation, + symbolrate, + diseqc, + switchingFrequency, + bandwidth, + majorChannel, + minorChannel, + pcrPid, + videoSource, + tuningSource +) +GO + + +CREATE TABLE History( + idHistory int IDENTITY(1,1) NOT NULL, + idChannel int NOT NULL, + startTime datetime NOT NULL, + endTime datetime NOT NULL, + title varchar(1000) NOT NULL, + description varchar(1000) NOT NULL, + genre varchar(1000) NOT NULL, + recorded bit NOT NULL, + watched int NOT NULL, + CONSTRAINT PK_History PRIMARY KEY CLUSTERED +( + idHistory ASC +) +) +GO diff --git a/TvEngine3/TVLibrary/SetupTv/delete_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/delete_mysql_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/delete_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/delete_mysql_database.sql index 6ffe25d2c10..c1cefdf2793 100644 --- a/TvEngine3/TVLibrary/SetupTv/delete_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/delete_mysql_database.sql @@ -1,6 +1,6 @@ --- --- Delete schema TvLibrary --- - -SET FOREIGN_KEY_CHECKS = 0; -DROP DATABASE IF EXISTS %TvLibrary%; +-- +-- Delete schema TvLibrary +-- + +SET FOREIGN_KEY_CHECKS = 0; +DROP DATABASE IF EXISTS %TvLibrary%; diff --git a/TvEngine3/TVLibrary/SetupTv/delete_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/delete_sqlserver_database.sql similarity index 96% rename from TvEngine3/TVLibrary/SetupTv/delete_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/delete_sqlserver_database.sql index c1a66ac84e1..85498097b35 100644 --- a/TvEngine3/TVLibrary/SetupTv/delete_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/delete_sqlserver_database.sql @@ -1,9 +1,9 @@ -use master -GO - -IF EXISTS (SELECT name FROM sysdatabases WHERE name = N'%TvLibrary%') -BEGIN - ALTER DATABASE %TvLibrary% set read_only with rollback immediate - ALTER DATABASE %TvLibrary% set read_write with rollback immediate - DROP DATABASE %TvLibrary% -END +use master +GO + +IF EXISTS (SELECT name FROM sysdatabases WHERE name = N'%TvLibrary%') +BEGIN + ALTER DATABASE %TvLibrary% set read_only with rollback immediate + ALTER DATABASE %TvLibrary% set read_write with rollback immediate + DROP DATABASE %TvLibrary% +END diff --git a/TvEngine3/TVLibrary/SetupTv/xx_upgrade_mysql_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/xx_upgrade_mysql_database.sql similarity index 94% rename from TvEngine3/TVLibrary/SetupTv/xx_upgrade_mysql_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/xx_upgrade_mysql_database.sql index d3c5cfb9716..28d710233dc 100644 --- a/TvEngine3/TVLibrary/SetupTv/xx_upgrade_mysql_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/xx_upgrade_mysql_database.sql @@ -1,9 +1,9 @@ -USE %TvLibrary%; -# - -/*Insert the upgrade statements below */ - - - -/* Set the new schema version here */ -UPDATE `Version` SET `versionNumber`=xx; +USE %TvLibrary%; +# + +/*Insert the upgrade statements below */ + + + +/* Set the new schema version here */ +UPDATE `Version` SET `versionNumber`=xx; diff --git a/TvEngine3/TVLibrary/SetupTv/xx_upgrade_sqlserver_database.sql b/TvEngine3/TVLibrary/SetupTv/SQL/xx_upgrade_sqlserver_database.sql similarity index 93% rename from TvEngine3/TVLibrary/SetupTv/xx_upgrade_sqlserver_database.sql rename to TvEngine3/TVLibrary/SetupTv/SQL/xx_upgrade_sqlserver_database.sql index 8b43caba7dc..12591bb3216 100644 --- a/TvEngine3/TVLibrary/SetupTv/xx_upgrade_sqlserver_database.sql +++ b/TvEngine3/TVLibrary/SetupTv/SQL/xx_upgrade_sqlserver_database.sql @@ -1,10 +1,10 @@ -use %TvLibrary% -GO - ----insert the upgrade statements below --- - - - ----set the new schema version here--- -UPDATE Version SET versionNumber=xx -GO +use %TvLibrary% +GO + +---insert the upgrade statements below --- + + + +---set the new schema version here--- +UPDATE Version SET versionNumber=xx +GO diff --git a/TvEngine3/TVLibrary/SetupTv/Sections/ImportExport.cs b/TvEngine3/TVLibrary/SetupTv/Sections/ImportExport.cs index 8383c49e71e..248b8618ec4 100644 --- a/TvEngine3/TVLibrary/SetupTv/Sections/ImportExport.cs +++ b/TvEngine3/TVLibrary/SetupTv/Sections/ImportExport.cs @@ -1,6 +1,6 @@ -#region Copyright (C) 2005-2011 Team MediaPortal +#region Copyright (C) 2005-2024 Team MediaPortal -// Copyright (C) 2005-2011 Team MediaPortal +// Copyright (C) 2005-2024 Team MediaPortal // http://www.team-mediaportal.com // // MediaPortal is free software: you can redistribute it and/or modify @@ -335,10 +335,11 @@ private void importButton_Click(object sender, EventArgs e) { dlg.Show(); dlg.WaitForDisplay(); + CountryCollection collection = new CountryCollection(); TvBusinessLayer layer = new TvBusinessLayer(); bool mergeChannels = false; // every exported channel will be imported on its own. - int cardCount = 0; + int channelCount = 0; int scheduleCount = 0; int settingCount = 0; diff --git a/TvEngine3/TVLibrary/SetupTv/Sections/ScanSettings.cs b/TvEngine3/TVLibrary/SetupTv/Sections/ScanSettings.cs index b16dfdee9a0..3189b551fe8 100644 --- a/TvEngine3/TVLibrary/SetupTv/Sections/ScanSettings.cs +++ b/TvEngine3/TVLibrary/SetupTv/Sections/ScanSettings.cs @@ -1,6 +1,6 @@ -#region Copyright (C) 2005-2011 Team MediaPortal +#region Copyright (C) 2005-2024 Team MediaPortal -// Copyright (C) 2005-2011 Team MediaPortal +// Copyright (C) 2005-2024 Team MediaPortal // http://www.team-mediaportal.com // // MediaPortal is free software: you can redistribute it and/or modify @@ -234,9 +234,8 @@ public override void OnSectionDeActivated() if (_needInformUser) { - if ( - MessageBox.Show(this, "The log level will be changed after you restart the TVService manually","Information about log level change", - MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK) ; + MessageBox.Show(this, "The log level will be changed after you restart the TVService manually", "Information about log level change", + MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } diff --git a/TvEngine3/TVLibrary/SetupTv/SetupDatabaseForm.cs b/TvEngine3/TVLibrary/SetupTv/SetupDatabaseForm.cs index 3b22a18c1af..bbe6d7aa128 100644 --- a/TvEngine3/TVLibrary/SetupTv/SetupDatabaseForm.cs +++ b/TvEngine3/TVLibrary/SetupTv/SetupDatabaseForm.cs @@ -29,9 +29,12 @@ using System.IO; using System.Net; using System.Reflection; +using System.Threading; using System.Windows.Forms; using System.Xml; + using MySql.Data.MySqlClient; + using TvLibrary.Interfaces; using TvLibrary.Log; @@ -115,7 +118,7 @@ public void LoadConnectionDetailsFromConfig(bool lookupMachineName) { // // - // + // try { XmlDocument doc = new XmlDocument(); @@ -145,10 +148,14 @@ public void LoadConnectionDetailsFromConfig(bool lookupMachineName) string part = parts[i]; string[] keyValue = part.Split('='); if (keyValue[0].ToLowerInvariant() == "password") + { tbPassword.Text = keyValue[1]; + } if (keyValue[0].ToLowerInvariant() == "user id" || keyValue[0].ToLowerInvariant() == "user") + { tbUserID.Text = keyValue[1]; + } if (keyValue[0].ToLowerInvariant() == "initial catalog" || keyValue[0].ToLowerInvariant() == "database") { @@ -164,12 +171,12 @@ public void LoadConnectionDetailsFromConfig(bool lookupMachineName) { switch (provider) { - case ProviderType.SqlServer: - tbServerHostName.Text = keyValue[1] = Dns.GetHostName() + @"\SQLEXPRESS"; - break; case ProviderType.MySql: tbServerHostName.Text = keyValue[1] = Dns.GetHostName(); break; + case ProviderType.SqlServer: + tbServerHostName.Text = keyValue[1] = Dns.GetHostName() + @"\SQLEXPRESS"; + break; } } } @@ -186,28 +193,40 @@ public void LoadConnectionDetailsFromConfig(bool lookupMachineName) } } - private string ComposeConnectionString(string server, string userid, string password, string database, bool pooling, - int timeout) + private string ComposeConnectionString(string server, string userid, string password, string database, bool pooling, int timeout) { schemaName = database; switch (provider) { - case ProviderType.SqlServer: - if (database == "") database = "master"; - if (pooling) - return - String.Format( - "Password={0};Persist Security Info=True;User ID={1};Initial Catalog={3};Data Source={2};Connection Timeout={4};", - password, userid, server, database, timeout); - return - String.Format( - "Password={0};Persist Security Info=True;User ID={1};Initial Catalog={3};Data Source={2};Pooling=false;Connection Timeout={4};", - password, userid, server, database, timeout); - + // MariaDB / MySQL case ProviderType.MySql: - if (database == "") database = "mysql"; - return String.Format("Server={0};Database={3};User ID={1};Password={2};charset=utf8;Connection Timeout={4};commandinterceptors=Gentle.Provider.MySQL.Interceptor.Interceptor,Gentle.Provider.MySQL.Interceptor;", + if (string.IsNullOrEmpty(database)) + { + database = "mysql"; + } + if (OSInfo.OSInfo.Win10OrLater() && Utils.Is64bitOS) + { + Log.Write("MariaDB / MySQL: Use the new connection string."); + return String.Format("Server={0};Database={3};User ID={1};Password={2};charset=utf8;Connection Timeout={4};commandinterceptors=Gentle.Provider.MySQL.Interceptor.Interceptor,Gentle.Provider.MySQL.Interceptor;", + server, userid, password, database, timeout); + } + Log.Write("MySQL: Use the old connection string."); + return String.Format("Server={0};Database={3};User ID={1};Password={2};charset=utf8;Connection Timeout={4};", server, userid, password, database, timeout); + + // MS SQL + case ProviderType.SqlServer: + if (string.IsNullOrEmpty(database)) + { + database = "master"; + } + if (pooling) + { + return String.Format("Password={0};Persist Security Info=True;User ID={1};Initial Catalog={3};Data Source={2};Connection Timeout={4};", + password, userid, server, database, timeout); + } + return String.Format("Password={0};Persist Security Info=True;User ID={1};Initial Catalog={3};Data Source={2};Pooling=false;Connection Timeout={4};", + password, userid, server, database, timeout); } return ""; } @@ -222,22 +241,23 @@ public bool TestConnection(StartupMode ModeType) } if (string.IsNullOrEmpty(tbServerHostName.Text) || string.IsNullOrEmpty(tbPassword.Text)) + { return false; + } - string connectionString = ComposeConnectionString(tbServerHostName.Text, tbUserID.Text, tbPassword.Text, "", - false, 15); + string connectionString = ComposeConnectionString(tbServerHostName.Text, tbUserID.Text, tbPassword.Text, "", false, 15); switch (provider) { - case ProviderType.SqlServer: - using (SqlConnection connect = new SqlConnection(connectionString)) + case ProviderType.MySql: + using (MySqlConnection connect = new MySqlConnection(connectionString)) { connect.Open(); connect.Close(); } break; - case ProviderType.MySql: - using (MySqlConnection connect = new MySqlConnection(connectionString)) + case ProviderType.SqlServer: + using (SqlConnection connect = new SqlConnection(connectionString)) { connect.Open(); connect.Close(); @@ -271,11 +291,11 @@ public bool ExecuteSQLScript(string prefix) Stream stream = null; switch (provider) { - case ProviderType.SqlServer: - stream = assm.GetManifestResourceStream("SetupTv." + prefix + "_sqlserver_database.sql"); - break; case ProviderType.MySql: - stream = assm.GetManifestResourceStream("SetupTv." + prefix + "_mysql_database.sql"); + stream = assm.GetManifestResourceStream("SetupTv.SQL." + prefix + "_mysql_database.sql"); + break; + case ProviderType.SqlServer: + stream = assm.GetManifestResourceStream("SetupTv.SQL." + prefix + "_sqlserver_database.sql"); break; } @@ -283,27 +303,36 @@ public bool ExecuteSQLScript(string prefix) string[] CommandScript = null; string sql = string.Empty; if (stream != null) + { using (StreamReader reader = new StreamReader(stream)) + { sql = reader.ReadToEnd(); + } + } + else + { + Log.Write("SetupTv.SQL." + prefix + "_mysql_database.sql - Not Found."); + return false; + } switch (provider) { - case ProviderType.SqlServer: - CommandScript = CleanMsSqlStatement(sql); - break; - case ProviderType.MySql: CommandScript = CleanMySqlStatement(sql); break; + + case ProviderType.SqlServer: + CommandScript = CleanMsSqlStatement(sql); + break; } // As the connection string sets the DB schema name we need to compose it after cleaning the statement. - string connectionString = ComposeConnectionString(tbServerHostName.Text, tbUserID.Text, tbPassword.Text, "", - true, 30); + string connectionString = ComposeConnectionString(tbServerHostName.Text, tbUserID.Text, tbPassword.Text, "", true, 30); switch (provider) { - case ProviderType.SqlServer: - using (SqlConnection connect = new SqlConnection(connectionString)) + // MariaDB / MySQL + case ProviderType.MySql: + using (MySqlConnection connect = new MySqlConnection(connectionString)) { connect.Open(); if (CommandScript != null) @@ -314,19 +343,20 @@ public bool ExecuteSQLScript(string prefix) { try { - using (SqlCommand cmd = new SqlCommand(SqlStmt, connect)) + using (MySqlCommand cmd = new MySqlCommand(SqlStmt, connect)) { Log.Write(" Exec SQL: {0}", SqlStmt); cmd.CommandTimeout = 60; // extra long 60 second timeout needed for long-running upgrade statements cmd.ExecuteNonQuery(); + + Thread.Sleep(0); } } - catch (SqlException ex) + catch (MySqlException ex) { Log.Write(" ********* SQL statement failed! *********"); Log.Write(" ********* Error reason: {0}", ex.Message); - Log.Write(" ********* Error code: {0}, Line: {1} *********", ex.Number.ToString(), - ex.LineNumber.ToString()); + Log.Write(" ********* Error code: {0} *********", ex.Number.ToString()); succeeded = false; if (connect.State != ConnectionState.Open) { @@ -339,8 +369,10 @@ public bool ExecuteSQLScript(string prefix) } } break; - case ProviderType.MySql: - using (MySqlConnection connect = new MySqlConnection(connectionString)) + + // MS SQL + case ProviderType.SqlServer: + using (SqlConnection connect = new SqlConnection(connectionString)) { connect.Open(); if (CommandScript != null) @@ -351,18 +383,19 @@ public bool ExecuteSQLScript(string prefix) { try { - using (MySqlCommand cmd = new MySqlCommand(SqlStmt, connect)) + using (SqlCommand cmd = new SqlCommand(SqlStmt, connect)) { Log.Write(" Exec SQL: {0}", SqlStmt); cmd.CommandTimeout = 60; // extra long 60 second timeout needed for long-running upgrade statements cmd.ExecuteNonQuery(); } } - catch (MySqlException ex) + catch (SqlException ex) { Log.Write(" ********* SQL statement failed! *********"); Log.Write(" ********* Error reason: {0}", ex.Message); - Log.Write(" ********* Error code: {0} *********", ex.Number.ToString()); + Log.Write(" ********* Error code: {0}, Line: {1} *********", ex.Number.ToString(), + ex.LineNumber.ToString()); succeeded = false; if (connect.State != ConnectionState.Open) { @@ -379,6 +412,7 @@ public bool ExecuteSQLScript(string prefix) } catch (Exception gex) { + Log.Write("ExecuteSQLScript: Unable to {0} database: {1}", prefix, gex.Message); MessageBox.Show(this, "Unable to " + prefix + " database:" + gex.Message); succeeded = false; } @@ -429,10 +463,11 @@ private void mpButtonTest_Click(object sender, EventArgs e) if (string.IsNullOrEmpty(tbUserID.Text)) { tbUserID.BackColor = Color.Red; - MessageBox.Show("Please specify a valid database user!", "Specify user", MessageBoxButtons.OK, - MessageBoxIcon.Error); + MessageBox.Show("Please specify a valid database user!", "Specify user", + MessageBoxButtons.OK, MessageBoxIcon.Error); return; } + if (string.IsNullOrEmpty(tbPassword.Text)) { tbPassword.BackColor = Color.Red; @@ -440,7 +475,9 @@ private void mpButtonTest_Click(object sender, EventArgs e) MessageBoxButtons.OK, MessageBoxIcon.Error); return; } - if (string.IsNullOrEmpty(tbDatabaseName.Text) || tbDatabaseName.Text.ToLowerInvariant() == "mysql" || + + if (string.IsNullOrEmpty(tbDatabaseName.Text) || + tbDatabaseName.Text.ToLowerInvariant() == "mysql" || tbDatabaseName.Text.ToLowerInvariant() == "master") { tbDatabaseName.BackColor = Color.Red; @@ -467,7 +504,9 @@ private void mpButtonTest_Click(object sender, EventArgs e) // Do not allow to "use" incorrect data if (_dialogMode != StartupMode.DbConfig) + { btnSave.Enabled = btnDrop.Enabled = TestSuccess; + } } finally { @@ -479,8 +518,7 @@ private void mpButtonTest_Click(object sender, EventArgs e) private bool AttemptMySqlTestConnect(string aTestDb) { provider = ProviderType.MySql; - string connectionString = ComposeConnectionString(tbServerHostName.Text, tbUserID.Text, tbPassword.Text, aTestDb, - false, 5); + string connectionString = ComposeConnectionString(tbServerHostName.Text, tbUserID.Text, tbPassword.Text, aTestDb, false, 5); try { @@ -493,9 +531,14 @@ private bool AttemptMySqlTestConnect(string aTestDb) catch (MySqlException myex) { if (myex.Number == 1049) //unknown database + { tbDatabaseName.BackColor = Color.Red; + } else + { tbServerHostName.BackColor = Color.Red; + } + MessageBox.Show(this, "Connection failed!\n" + myex.Message); return false; } @@ -505,10 +548,12 @@ private bool AttemptMySqlTestConnect(string aTestDb) MessageBox.Show(this, "Connection failed!\n" + ex.Message); return false; } + tbServerHostName.BackColor = Color.GreenYellow; tbUserID.BackColor = Color.GreenYellow; tbPassword.BackColor = Color.GreenYellow; tbDatabaseName.BackColor = Color.GreenYellow; + MessageBox.Show(this, "Connection succeeded!"); return true; } @@ -516,8 +561,7 @@ private bool AttemptMySqlTestConnect(string aTestDb) private bool AttemptMsSqlTestConnect(string aTestDb) { provider = ProviderType.SqlServer; - string connectionString = ComposeConnectionString(tbServerHostName.Text, tbUserID.Text, tbPassword.Text, aTestDb, - false, 5); + string connectionString = ComposeConnectionString(tbServerHostName.Text, tbUserID.Text, tbPassword.Text, aTestDb, false, 5); try { @@ -566,11 +610,14 @@ private bool AttemptMsSqlTestConnect(string aTestDb) MessageBox.Show(this, "Connection failed!\n" + ex.Message); return false; } + SqlConnection.ClearAllPools(); + tbServerHostName.BackColor = Color.GreenYellow; tbUserID.BackColor = Color.GreenYellow; tbPassword.BackColor = Color.GreenYellow; tbDatabaseName.BackColor = Color.GreenYellow; + MessageBox.Show(this, "Connection succeeded!"); return true; } @@ -626,18 +673,25 @@ private void mpButtonSave_Click(object sender, EventArgs e) DialogResult = DialogResult.OK; if (_dialogMode == StartupMode.Normal) + { Application.Restart(); + } else + { Close(); + } } private void btnDrop_Click(object sender, EventArgs e) { if (ExecuteSQLScript("delete")) - MessageBox.Show("Your old database has been dropped.", "Success", MessageBoxButtons.OK, - MessageBoxIcon.Information); + { + MessageBox.Show("Your old database has been dropped.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); + } else + { MessageBox.Show("Failed to drop the database.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } Close(); } @@ -655,12 +709,38 @@ public int GetCurrentShemaVersion(StartupMode ModeType) { LoadConnectionDetailsFromConfig(false); } + try { - string connectionString = ComposeConnectionString(tbServerHostName.Text, tbUserID.Text, tbPassword.Text, - tbDatabaseName.Text, false, 15); + string connectionString = ComposeConnectionString(tbServerHostName.Text, tbUserID.Text, tbPassword.Text, tbDatabaseName.Text, false, 15); + switch (provider) { + // MariaDB / MySQL + case ProviderType.MySql: + { + using (MySqlConnection connect = new MySqlConnection(connectionString)) + { + connect.Open(); + using (MySqlCommand cmd = connect.CreateCommand()) + { + cmd.CommandType = CommandType.Text; + cmd.CommandText = "select * from Version"; + using (IDataReader reader = cmd.ExecuteReader()) + { + if (reader.Read()) + { + currentSchemaVersion = (int)reader["versionNumber"]; + reader.Close(); + connect.Close(); + } + } + } + } + } + break; + + // MS SQL case ProviderType.SqlServer: { using (SqlConnection connect = new SqlConnection(connectionString)) @@ -684,29 +764,6 @@ public int GetCurrentShemaVersion(StartupMode ModeType) } } break; - - case ProviderType.MySql: - { - using (MySqlConnection connect = new MySqlConnection(connectionString)) - { - connect.Open(); - using (MySqlCommand cmd = connect.CreateCommand()) - { - cmd.CommandType = CommandType.Text; - cmd.CommandText = "select * from Version"; - using (IDataReader reader = cmd.ExecuteReader()) - { - if (reader.Read()) - { - currentSchemaVersion = (int)reader["versionNumber"]; - reader.Close(); - connect.Close(); - } - } - } - } - } - break; } return currentSchemaVersion; } @@ -742,7 +799,7 @@ public bool UpgradeDBSchema(int currentSchemaVersion) //Stream stream = null; for (int version = currentSchemaVersion + 1; version < 100; version++) { - if (ResourceExists(names, "SetupTv." + version + "_upgrade_sqlserver_database.sql")) + if (ResourceExists(names, "SetupTv.SQL." + version + "_upgrade_sqlserver_database.sql")) { if (ExecuteSQLScript(version + "_upgrade")) Log.Info("- database upgraded to schema version " + version); @@ -750,7 +807,9 @@ public bool UpgradeDBSchema(int currentSchemaVersion) return false; } else + { break; + } } return true; } @@ -763,7 +822,10 @@ public bool IsDatabaseOnLocalMachine(string DBServerName) { // please add better check if needed if (DBServerName.ToLowerInvariant() == Environment.MachineName.ToLowerInvariant()) + { return true; + } + // Check for ip addresses IPHostEntry ipEntry = Dns.GetHostEntry(Environment.MachineName); IPAddress[] addr = ipEntry.AddressList; @@ -792,6 +854,17 @@ public void CheckServiceName() // first try the quick method and assume the user is right or using defaults string ConfiguredServiceName = tbServiceDependency.Text; string DBSearchPattern = @"MySQL"; + + // MS SQL + if (rbSQLServer.Checked) + { + DBSearchPattern = @"SQLBrowser"; + } + else if ( !(OSInfo.OSInfo.Win10OrLater() && Utils.Is64bitOS) ) + { + DBSearchPattern = @"MySQL5"; + } + Color clAllOkay = Color.GreenYellow; if (ServiceHelper.IsInstalled(ConfiguredServiceName)) @@ -801,10 +874,6 @@ public void CheckServiceName() } else { - // MSSQL - if (rbSQLServer.Checked) - DBSearchPattern = @"SQLBrowser"; - if (ServiceHelper.GetDBServiceName(ref DBSearchPattern)) { tbServiceDependency.Text = DBSearchPattern; @@ -812,8 +881,18 @@ public void CheckServiceName() } else { - Log.Info("SetupDatabaseForm: DB service name not recognized - using defaults"); - tbServiceDependency.BackColor = Color.Red; + // Maria DB + DBSearchPattern = @"MariaDB"; + if (ServiceHelper.GetDBServiceName(ref DBSearchPattern)) + { + tbServiceDependency.Text = DBSearchPattern; + tbServiceDependency.BackColor = clAllOkay; + } + else + { + Log.Info("SetupDatabaseForm: DB service name not recognized - using defaults [{0}]", DBSearchPattern); + tbServiceDependency.BackColor = Color.Red; + } } } @@ -836,17 +915,24 @@ public void CheckServiceName() { // enable the dependency now if (!ServiceHelper.IsServiceEnabled(DBSearchPattern, true)) - MessageBox.Show("Failed to change the startup behaviour", "Dependency error", MessageBoxButtons.OK, - MessageBoxIcon.Error); + { + MessageBox.Show("Failed to change the startup behaviour", "Dependency error", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } } // start the service right now if (!ServiceHelper.Start(DBSearchPattern)) + { MessageBox.Show(string.Format("Failed to start the dependency service: {0}", DBSearchPattern), - "Dependency start error", MessageBoxButtons.OK, MessageBoxIcon.Error); + "Dependency start error", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } } } else + { Log.Info("SetupDatabaseForm: Could not add dependency for TvService - {0}", DBSearchPattern); + } } } @@ -872,7 +958,16 @@ private void radioButton2_CheckedChanged(object sender, EventArgs e) tbServerHostName.Text = Dns.GetHostName(); tbServiceDependency.Enabled = true; tbServiceDependency.BackColor = tbServerHostName.BackColor; - tbServiceDependency.Text = @"MySQL5"; + + if (OSInfo.OSInfo.Win10OrLater() && Utils.Is64bitOS) + { + tbServiceDependency.Text = @"MySQL"; + } + else + { + tbServiceDependency.Text = @"MySQL5"; + } + string dependency = ServiceHelper.ReadDependency(); if (!string.IsNullOrEmpty(dependency)) { @@ -917,7 +1012,9 @@ private void lblDBChoice_LinkClicked(object sender, LinkLabelLinkClickedEventArg private void tbPassword_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) + { mpButtonTest_Click(sender, null); + } } private void pbSQLServer_Click(object sender, EventArgs e) @@ -933,31 +1030,41 @@ private void pbMySQL_Click(object sender, EventArgs e) private void tbServerHostName_TextChanged(object sender, EventArgs e) { if (tbServerHostName.BackColor == Color.Red) + { tbServerHostName.BackColor = SystemColors.Window; + } } private void tbServiceDependency_TextChanged(object sender, EventArgs e) { if (tbServiceDependency.BackColor == Color.Red) + { tbServiceDependency.BackColor = SystemColors.Window; + } } private void tbUserID_TextChanged(object sender, EventArgs e) { if (tbUserID.BackColor == Color.Red) + { tbUserID.BackColor = SystemColors.Window; + } } private void tbPassword_TextChanged(object sender, EventArgs e) { if (tbPassword.BackColor == Color.Red) + { tbPassword.BackColor = SystemColors.Window; + } } private void tbDatabaseName_TextChanged(object sender, EventArgs e) { if (tbDatabaseName.BackColor == Color.Red) + { tbDatabaseName.BackColor = SystemColors.Window; + } } #endregion diff --git a/TvEngine3/TVLibrary/SetupTv/SetupTv.csproj b/TvEngine3/TVLibrary/SetupTv/SetupTv.csproj index fe222958742..b68c3689a8a 100644 --- a/TvEngine3/TVLibrary/SetupTv/SetupTv.csproj +++ b/TvEngine3/TVLibrary/SetupTv/SetupTv.csproj @@ -381,23 +381,7 @@ Resources.resx True - - - - - - - - - - - - - - - - Form @@ -695,8 +679,6 @@ TvSchedules.cs - - Designer SettingsForm.cs @@ -705,21 +687,11 @@ Designer SetupDatabaseForm.cs - - - - - - - - - - FormAnalogTuningDetail.cs Designer @@ -767,28 +739,6 @@ ThirdPartyChecks.cs Designer - - - - - - - - - - - - - - - - - - - - - - @@ -800,8 +750,6 @@ - - @@ -810,6 +758,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + - - + + + + + + diff --git a/TvEngine3/TVLibrary/SetupTv/Startup.cs b/TvEngine3/TVLibrary/SetupTv/Startup.cs index 26320e03da6..bc266eb308b 100644 --- a/TvEngine3/TVLibrary/SetupTv/Startup.cs +++ b/TvEngine3/TVLibrary/SetupTv/Startup.cs @@ -1,6 +1,6 @@ -#region Copyright (C) 2005-2011 Team MediaPortal +#region Copyright (C) 2005-2024 Team MediaPortal -// Copyright (C) 2005-2011 Team MediaPortal +// Copyright (C) 2005-2024 Team MediaPortal // http://www.team-mediaportal.com // // MediaPortal is free software: you can redistribute it and/or modify @@ -217,7 +217,7 @@ public static void Main(string[] arguments) dlg.SaveGentleConfig(); } } - else if (String.IsNullOrEmpty(DeploySql) || String.IsNullOrEmpty(DeployPwd)) + else if (string.IsNullOrEmpty(DeploySql) || string.IsNullOrEmpty(DeployPwd)) { dlg.LoadConnectionDetailsFromConfig(true); } @@ -229,7 +229,14 @@ public static void Main(string[] arguments) dlg.rbMySQL.Checked = true; dlg.tbUserID.Text = "root"; dlg.tbServerHostName.Text = Dns.GetHostName(); - dlg.tbServiceDependency.Text = @"MySQL5"; + if (OSInfo.OSInfo.Win10OrLater() && Utils.Is64bitOS) + { + dlg.tbServiceDependency.Text = @"MySQL"; + } + else + { + dlg.tbServiceDependency.Text = @"MySQL5"; + } } else { @@ -259,6 +266,7 @@ public static void Main(string[] arguments) if (dlg.ShowDialog() != DialogResult.OK || startupMode != StartupMode.DeployMode) return; // close the application without restart here. } + dlg.CheckServiceName(); if (startupMode == StartupMode.DeployMode) { diff --git a/TvEngine3/TVLibrary/SetupTv/Util.cs b/TvEngine3/TVLibrary/SetupTv/Util.cs index df007aa4c6a..3c12573a05d 100644 --- a/TvEngine3/TVLibrary/SetupTv/Util.cs +++ b/TvEngine3/TVLibrary/SetupTv/Util.cs @@ -749,6 +749,11 @@ public static string ReplaceTag(string line, string tag, string value) return ReplaceTag(line, tag, value, string.Empty); } + public static bool Is64bitOS + { + get { return Environment.Is64BitOperatingSystem; } + } + public static ulong GetDiskSpace(string drive) { if (drive.StartsWith(@"\")) diff --git a/mediaportal/MPE/MpeInstaller/MpeInstaller.manifest b/mediaportal/MPE/MpeInstaller/MpeInstaller.manifest index 3391c8e915c..032862c0e2b 100644 --- a/mediaportal/MPE/MpeInstaller/MpeInstaller.manifest +++ b/mediaportal/MPE/MpeInstaller/MpeInstaller.manifest @@ -12,10 +12,16 @@ - - - - + + + + + + + + + + \ No newline at end of file