20230512035949_create_fish_ad_table.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. use think\facade\Db;
  3. use think\migration\Migrator;
  4. use think\migration\db\Column;
  5. class CreateFishAdTable extends Migrator
  6. {
  7. /**
  8. * Change Method.
  9. *
  10. * Write your reversible migrations using this method.
  11. *
  12. * More information on writing migrations is available here:
  13. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  14. *
  15. * The following commands can be used in this method and Phinx will
  16. * automatically reverse them when rolling back:
  17. *
  18. * createTable
  19. * renameTable
  20. * addColumn
  21. * renameColumn
  22. * addIndex
  23. * addForeignKey
  24. *
  25. * Remember to call "create()" or "update()" and NOT "save()" when working
  26. * with the Table class.
  27. */
  28. public function change()
  29. {
  30. Db::execute("CREATE TABLE `fl_fish_campaign` (
  31. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  32. `advertiser_id` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '广告主ID',
  33. `campaign_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '广告组id',
  34. `campaign_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '广告组name',
  35. `stat_datetime` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据起始时间',
  36. `inventory` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '投放广告位',
  37. `cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '展现数据-总花费',
  38. `show` int(11) NULL DEFAULT 0 COMMENT '展现数据-展示数',
  39. `avg_show_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '展现数据-平均千次展现费用',
  40. `click` int(11) NULL DEFAULT 0 COMMENT '展现数据-点击数',
  41. `avg_click_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '展现数据-平均点击单价',
  42. `ctr` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '展现数据-点击率',
  43. `convert` int(11) NULL DEFAULT 0 COMMENT '转化数据-转化数',
  44. `convert_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '转化数据-转化成本',
  45. `convert_rate` int(11) NULL DEFAULT 0 COMMENT '转化数据-转化率',
  46. `deep_convert` int(11) NULL DEFAULT 0 COMMENT '转化数据-深度转化数',
  47. `deep_convert_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '转化数据-深度转化成本',
  48. `deep_convert_rate` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '转化数据-深度转化率',
  49. `root_id` int(11) NULL DEFAULT 0 COMMENT '关联组织',
  50. `data_time` date NULL DEFAULT NULL COMMENT '数据日期-每日请求一次插入数据',
  51. `type` tinyint(1) NULL DEFAULT 1 COMMENT '1飞鱼2腾讯3欧派',
  52. PRIMARY KEY (`id`) USING BTREE,
  53. INDEX `root_id`(`root_id`) USING BTREE,
  54. INDEX `advertiser_id`(`advertiser_id`) USING BTREE,
  55. INDEX `data_time`(`data_time`) USING BTREE
  56. ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '飞鱼广告数据' ROW_FORMAT = DYNAMIC;");
  57. }
  58. }